Braintree DropIn表单显示更改付款方式

时间:2017-05-03 20:55:37

标签: meteor nodes braintree

我在流星应用程序中使用Braintree DropIn付款表。它工作正常创建表单,并能够创建一个事务。但是,当我提交表单时,它会显示新屏幕,显示当前的付款方式和更新它的链接。一旦服务器返回呼叫,我的自定义确认页面就会显示出来。

所以工作流程序列是:
1. DropIn Payment From(信用卡,exp dt,cvv,..)
2.单击“提交”按钮
3. onPaymentMethodReceived:安装程序的一部分称为
虽然还没有完成 4.显示一个新的临时屏幕(更改pymt方法的选项)
5. onPaymentMethodReceived:部分完成,自定义付款确认屏幕替换上一个屏幕

如何摆脱此更新付款方式屏幕。

以下是代码:

`Template.billPay.onRendered(function() {
  console.log('Satrt billPay Render');
  Meteor.call('getClientToken', function(error, clientToken) {
    if (error) {
      console.log('Client Token Err');
      console.log(error);
    } else {
     braintree.setup(clientToken, "dropin", {
        container: "payment-form",
        onPaymentMethodReceived: function (response) {
          var nonce = response.nonce;
          Session.set('pymtResponse',response.details);
          Session.set('nonce',nonce);

          $('.paySubmit').prop('disabled', true);
           Meteor.call('btCreateCustomer', function(error, success) {
            if (error) {
              throw new Meteor.Error('customer-creation-failed');
            } else {
              Meteor.call('createTransaction', Session.get('nonce'), function(error, success) {
                 Session.set('pymtTxId', success.transaction.id);
                 Session.set('pymtTxId', success.transaction.id);
                }
              });
            }
          });
          return false;
        }
      });
    }
  });
});`

1 个答案:

答案 0 :(得分:0)

完全披露:我在Braintree工作。如果您有任何其他问题,请随时联系support

当客户输入付款方式时,所选付款方式将在压缩视图中显示您的Drop-In UI的DOM元素,提供一些基本信息,如信用卡号码的最后2位数字和卡牌,如果选择了PayPal电子邮件地址,则为该地址。 “更改付款方式”链接和紧凑视图是Drop-In UI的一部分,将与客户以前的付款方式一起显示,直到提交表单。

也就是说,当您使用onPaymentMethodReceived回调时,Drop-In UI将不再向您的表单中注入payment_method_nonce DOM元素并提交它,因此为了删除Drop -in页面中的用户界面,您可以通过将其display样式值更改为none来隐藏其显示的DOM元素,也可以选择使用teardown来删除在该页面中创建的任何内容。设置调用,包括付款方式显示。

相关问题