拥有使用CB和PayPal的Braintree自定义表单

时间:2014-11-03 16:22:25

标签: javascript .net paypal braintree

我们不想使用Braintree的dropin表单来坚持使用我们的UI。 到目前为止,我们只有CC字段的付款方式运作良好。我们用:

设置braintree.js
braintree.setup(token, "custom", {
  id: "options"
});

然后是PayPal,我们将PayPal容器添加到设置中:

braintree.setup(token, "custom", {
  id: "options",
  paypal: {
    container: "paypal-button"
  }
});

直到上周六,一切都在当地工作。通过挖掘,我发现在填写CC字段时,payment_method_nonce不再被发送到服务器: missing nonce server side

尽管nonce输入在我的表单中存在于客户端! enter image description here

那么这里的问题是什么? braintree.js是否以某种方式与表单提交进行交互?为什么这个payment_method_nonce有时会被检索到服务器端(当通过PayPal付款时),有时候不是(通过CC付款时)?

由于

2 个答案:

答案 0 :(得分:2)

你几乎就在那里。你需要使用" custom"当您使用自己的信用卡表单和额外的PayPal按钮时作为集成方法:

braintree.setup(token, "custom", {
  id: "options",
  paypal: {
    container: "paypal-button"
  }
});

答案 1 :(得分:0)

好吧,原来这个问题出现在布伦特里的一边。

使用大于2.2.4的braintree.js版本的https://js.braintreegateway.com/v2/braintree.js解决了这个问题。