我正在使用 Braintree 支付、PHP 和 JavaScript 构建一个简单的支付系统。我正在使用 Braintree 的 Drop-in UI,并希望创建订阅(即定期计费)。
为此,我使用:
// $_customer is a Braintree_Customer object; a customer stored in the Vault
$subscription_create = Braintree_Subscription::create([
'id' => $_customer->id,
'planId' => 'some_package',
'paymentMethodToken' => $_customer->defaultPaymentMethod()->token
]);
这工作正常,并使用客户的“默认付款方式”创建订阅。但是,我看不到客户可以更改其默认付款方式的任何方式。嵌入式 UI 中似乎没有此选项。
这是否意味着我不能使用嵌入式 UI 进行定期计费?我是否应该编写自己的 UI 以允许客户更改他们的默认付款方式?
There is a way使付款方式成为默认付款方式。我可以使用那个,但是,我只从客户那里收到一个 paymentMethodNonce。我如何找到链接到该随机数的 paymentMethod?
最佳答案
我在布伦特里工作。如果有更多问题,可以随时get in touch with our support team .
你不需要特殊的方法,你可以pass the nonce directly to Braintree_PaymentMethod::create
:
$result = Braintree_PaymentMethod::create(array(
'customerId' => '12345',
'paymentMethodNonce' => 'nonce-from-the-client'
));
关于javascript - 使用 Braintree 下拉 UI 选择定期计费的付款方式——或 : finding the payment method of a paymentMethodNonce,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30274732/