简体   繁体   English

如何使Braintree v.zero显示现有付款方式?

[英]How to get Braintree v.zero to show existing payment methods?

Setting up a payment form with the Braintree v.zero SDK: 使用Braintree v.zero SDK设置付款表格:

braintree.setup(response.value, 'dropin', {
  container : 'xyz',
  onPaymentMethodReceived : function(payment) { 
    pay(payment.nonce);
  },
});

After entering payment information, the form shows: 输入付款信息后,该表格显示:

在此处输入图片说明

...but only until the page is reloaded. ...但仅在重新加载页面之前。 Is there a way to initialize the dropin payment form to list a customer's existing payment methods? 有没有办法初始化直接付款表格以列出客户现有的付款方式?

Full disclosure: I work at Braintree. 全面披露:我在Braintree工作。 If you have any further questions, feel free to contact support . 如果您还有其他疑问,请随时与支持小组联系。

The key would seem to lie with your response.value (ie your client token). 关键似乎在于您的response.value (即您的客户令牌)。 I would guess that your server code used to generate it isn't specifying a customerId for that user. 我想您用来生成它的服务器代码没有为该用户指定customerId。 ​ From the Braintree documentation on generating client tokens : Braintree文档中生成客户端令牌

Your server is responsible for generating a client token, which contains all authorization and configuration information your client needs to initialize the client SDK to communicate with Braintree. 您的服务器负责生成客户端令牌,其中包含客户端初始化客户端SDK与Braintree进行通信所需的所有授权和配置信息。 Including a customerId when generating the client token lets returning customers select from previously used payment method options, improving user experience over multiple checkouts. 生成客户令牌时包含customerId可使回头客从以前使用的付款方式选项中进行选择,从而改善了多次结帐时的用户体验。 Set Up Your Client covers the client side of the exchange. 设置您的客户涵盖了交易所的客户端。

Bottom-line: Drop-in will display multiple cards if you generate your Client Token using the customer_id that matches your customer. 底线:如果您使用与customer_id匹配的customer_id生成客户令牌,则插件将显示多张卡。

client_token = braintree.ClientToken.generate({
     "customer_id": a_customer_id
}) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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