2017-05-03 109 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元素,這將刪除在設置調用中創建的任何內容,其中包括付款方式顯示。