本文介绍了Braintree-PaymentMethodNonceReceived没有被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为Braintree设置了dropin UI.我可以看到用户界面很好.在此之前,我创建了客户,并且可以在braintree-sandbox上看到该客户.现在,我想向客户添加付款方式.我正在尝试遵循以下代码,但未调用paymentMethodNonceReceived.不知道为什么.

I have setup dropin UI for braintree. I can see the UI fine. Before that I created the customer and I can see the customer on braintree-sandbox. Now I want to add payment method to the customer. I am trying following code, but paymentMethodNonceReceived is not being invoked. Not sure why.

braintree.setup("<?=CLIENT_TOKEN_FROM_PHP?>", 
    "dropin", 
    {
      container: "divBrainTreeContainer",
      paymentMethodNonceReceived: function (event, nonce) {
        console.log(nonce);
        $('#formProfile').append('<input type="hidden" name="payment_method_nonce" value="'+nonce+'" />');
        $('#formProfile').submit();
      }
    }
);

推荐答案

根据@kdetella的评论,<form>元素内应有一个submit按钮,以接收付款方式随机数.

As per @kdetella's comment, there should be a submit button inside the <form> element to receive payment method nonce.

这篇关于Braintree-PaymentMethodNonceReceived没有被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 19:46