BrainTreePayments 创建新的支付方式

BrainTreePayments create new payment method

我正在浏览 BrainTreePayments 文档页面,我遇到了付款方式。文档说 "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) { });

问题是

1) 我们如何在没有付款方式随机数的情况下为新客户创建新的付款方式? 2) 我们如何验证现有支付方式的有效性?

完全披露:我在 Braintree 工作。如果您有任何其他问题,请随时联系 support

1) 支付方式就像一个容器,可以将存储 支付信息存储在您的保险柜中,而payment method nonce 是一种交付 向 Braintree 支付信息。您使用支付方式随机数来传递支付信息以创建支付方式、交易等。可以引用支付方式以从存储的支付信息生成支付方式随机数,但支付方式必须存储一些东西。您不能创建空的付款方式。

2) 要验证现有的付款方式,请使用 '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