2017-06-14 5 views
0

私のcordovaアプリケーションに "braintree"支払いプラグインを統合しようとしています。私はbraintreeプラグインを正常に初期化することができます。しかし、私は支払いページのUIを取得することができません。それは私の作品事前Cordova braintree plugin

+0

あなたはどちらのプラグインを使用していますか? [Braintreeがネイティブフレームワークをサポートしていない](https://stackoverflow.com/a/36986655/5326365)を考えれば、プラグインの開発者にもっと良い運を伝えることができます。さらに、 '#presentDropInPaymentUI'を呼び出すときに特定のエラーやログを使って質問を更新すると非常に役に立ちます。 – Shea

答えて

0

// Initializing... this is working fine 

var token = "xxcssf..."; 

BraintreePlugin.initialize(token, 
    function() { console.log("init OK!"); }, 
    function (error) { console.error(error); 
});  

// Calling the payment method... not able to execute this code... not getting issues too 

var options = { 
    amount: "49.99", 
    primaryDescription: "Your Item" 
}; 

BraintreePlugin.presentDropInPaymentUI(options, function (result) { 
    if (result.userCancelled) { 
     console.debug("User cancelled payment dialog."); 
    } else { 
     console.info("User completed payment dialog."); 
     console.info("Payment Nonce: " + result.nonce); 
     console.debug("Payment Result.", result); 
    } 
}); 

おかげで、このよう:

  1. はheadタグ内にこれを入れて:

    <script src="https://js.braintreegateway.com/web/dropin/1.4.0/js/dropin.min.js"></script> 
    
  2. だけで終わる、このタグを追加しますボディータグ:

    <div id="payment-form"></div> 
    
  3. コントローラのbraintreeServiceと$ windowを呼び出します。

これですべての機能が有効になります。

Good Luck!