Search code examples
braintreebraintree-sandbox

BraintreeError HOSTED_FIELDS_FIELDS_EMPTY despite non empty values


If I look inside hostedFieldsInstance._state.fields.number.container.value I can see that the value is not empty.

However when I do:

hostedFieldsInstance.tokenize(function (tokenizeErr, payload) {

I get the following error:

i {name: "BraintreeError", code: "HOSTED_FIELDS_FIELDS_EMPTY",         message: "All fields are empty. Cannot tokenize empty card fields.", type: "CUSTOMER", details: undefined}

Solution

  • I figured it out it was because I used inputs instead of divs as in the example however I do not know how the example did work