kemsbe
kemsbe

Reputation: 605

Braintree use hosted fields to update payment method data

I use Braintree with NodeJS and AngularJS and need to update payment method data. I want to use hosted fields because of safety and validation, but paymentMethod.update() method of Braintree SDK requires card data to be passed in form like that:

gateway.paymentMethod.update(payMethodToken, {
    cardholderName: req.body.update.name,
    cvv: req.body.update.cvv,
    expirationDate:  req.body.update.exp
}

and it seems imposible to get this data from hosted fields. So, is there a way to somehow transform data from hosted fields submit to data I can pass into paymentMethod.update()? If not, what can be another safe way to update payment method data?

Upvotes: 0

Views: 548

Answers (1)

jellenberger
jellenberger

Reputation: 506

Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.

Hosted Fields prevents you from ever interacting with the credit card number or cvv. Instead, if you want to update a user's payment information, call update with a paymentMethodNonce, using the nonce your client receives from Braintree upon form submission. Optionally, you may also include non-Hosted Field information that you would like associated with that payment method.

Upvotes: 1

Related Questions