Braintree 支付网关:处理 "payment_method_token"?

Braintree payment gateway: Dealing with "payment_method_token"?

我是 brain tree 支付网关的新手。我不明白什么是 payment_method_nonce(最终用户提供的令牌)或这个令牌是如何生成的?

我也不知道如何获取客户卡详细信息、如何存储它以及如何与 "payment_method_token"

进行交易
result = Braintree::PaymentMethodNonce.create("A_PAYMENT_METHOD_TOKEN")
nonce = result.payment_method_nonce.nonce

任何人都可以解释如何创建或获取 A_PAYMENT_METHOD_TOKEN 吗?

payment_method_nonce 是您的 braintree 表单提交给您的控制器的参数。

您可以使用 nonce_from_the_client = params['payment_method_nonce'] 创建 braintree Transaction

result = Braintree::Transaction.sale(
  :amount => "100.00",
  :payment_method_nonce => nonce_from_the_client
)

paymentmethodtoken 是我们用于购物的客户信用卡的唯一标识符。

如果您检查结果对象,您可以从中提取支付方式令牌,并可以存储在您身边,以供同一用户将来进行交易,而无需输入银行卡详细信息。

这是将支付方式随机数保存为支付方式令牌所必需的。付款方式随机数只能使用一次,其中令牌是一个不会过期的可重复使用的值。

创建订阅时,您需要先 create the customer and payment method in one call, and then use the payment method token from the result object to create the subscription. Keep in mind that you will need to first create a plan in the Control Panel, but you can override most of the plan details

使用存储的付款方式创建客户后,您可以使用返回的令牌为用户订阅计划。这篇文章解释得很好: https://developers.braintreepayments.com/guides/recurring-billing/overview

站点点团队关于如何集成 Braintree 的实时示例可以在下面找到 link:

Integrate Braintree Payments into Rails