braintree如何为准备订阅的付款方式提供保管 [英] braintree how to vault a payment method ready for subscription

查看:91
本文介绍了braintree如何为准备订阅的付款方式提供保管的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用付款方式创建一个客户,然后将付款方式存储在Vault中

I'd like to create a customer with a payment method then store the payment method in the vault

然后为用户创建订阅

到目前为止,我有这个:

so far I have this:

    $rs = \Braintree_Customer::create([
            'id'                 =>$m_id,
            'firstName'          =>$username,
            'paymentMethodNonce' =>$nonce
            ]);

但是这似乎不是在金库中存储付款方式,上面的代码对于在金库中存储付款方式是否正确?

but this doesn't appear to be storing payment methods in the vault, is the above code correct for storing payment methods in the vault?

推荐答案

您需要将 customer_id paymentmethodnonce 发送给BT.遵循方式

You need to send the customer_id and paymentmethodnonce to BT. Follow the ways

$result = Braintree_PaymentMethod::create([
    'customerId' => '12345',
    'paymentMethodNonce' => nonceFromTheClient
]);

从结果中,您可以获取大脑树令牌(令牌= result.payment_method.token)存储在数据库中.您可以使用此令牌进行订阅.

From the result you can get the braintree token (token = result.payment_method.token) store in the database. You can use this token for the subscription.

这篇关于braintree如何为准备订阅的付款方式提供保管的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆