2017-05-03 103 views
0

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

所以工作流程顺序为:
1.脱入支付从(信用卡,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; 
     } 
     }); 
    } 
    }); 
});` 
+0

您会添加生成客户端令牌的服务器端代码吗? – ThinkAboutIt

+0

这里是生成服务器代码的令牌:
'Meteor.methods({ getClientToken:函数(的clientId){ VAR的generateToken = Meteor.wrapAsync(gateway.clientToken.generate,gateway.clientToken); VAR选项= { }; 变种BTID = Meteor.user()custBtId; 的console.log( 'genToken BTID' + BTID); // = options.customerId BTID; 尝试{ 变种响应=的generateToken(选项); // console.log('client token'+ response.clientToken); return response.clientToken; } catch(err){console.log(err.message); return err} } })' –

回答

0

全面披露:我在布伦特里工作。如果您还有其他问题,请随时联系support

当客户输入付款方式时,选定的付款方式将显示在压缩视图中的Drop-In用户界面的DOM元素中,提供一些基本信息,如信用卡号的最后2位数字和卡品牌或贝宝电子邮件地址(如果选择)。 “更改付款方式”链接和精简视图是下拉式用户界面的一部分,并会在提交表单之前与客户以前的付款方式一起显示。

这就是说,当你正在使用的onPaymentMethodReceived回调,落入式UI将不再注入payment_method_nonce DOM元素到您的形式和顺序提交,所以从网页移除落入式UI,您可以通过将其display样式值更改为none或选择使用teardown来隐藏其显示的DOM元素,这将删除在设置调用中创建的任何内容,其中包括付款方式显示。