简体   繁体   中英

BrainTreePayments create new payment method

I am going through the BrainTreePayments documentation page and I came across the Payment Methods. The documentation says "To create a new payment method for an existing customer, the only required attributes are the customer ID and payment method nonce."

gateway.paymentMethod.create({
  customerId: "12345",
  paymentMethodNonce: nonceFromTheClient
}, function (err, result) { });

The question is

1) How do we create a new payment method for a new customer without payment method nonce? 2) How do we verify the validity of an existing payment method?

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

1) A payment method is like a container to store payment information in your Vault, whereas the payment method nonce is a way to deliver payment information to Braintree. You use a payment method nonce to deliver payment information to create payment methods, transactions, etc. A payment method can be referenced to generate a payment method nonce from stored payment information, but the payment method must store something. You can't create an empty payment method.

2) To verify an existing payment method, use 'PaymentMethod.update()' and include 'verify_card' in your options. If you have enabled fraud tools in your control panel, newly created payment methods for credit cards will be verified before they are stored in the Vault. Cards that are not valid will not be stored and you will receive an error response .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM