【问题标题】:Cordova braintree pluginCordova Braintree 插件
【发布时间】:2017-11-16 11:11:08
【问题描述】:

我正在尝试将“braintree”支付插件集成到我的 cordova 应用程序中。我能够成功初始化braintree插件。但我无法获取支付页面的 UI。

// 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);
    }
});

提前致谢

【问题讨论】:

  • 您使用的是哪个插件?考虑到Braintree does not support compile-to-native frameworks,您可能会更幸运地联系到插件的开发人员。此外,如果您在调用 #presentDropInPaymentUI 时使用特定错误或一些日志记录更新您的问题,这将非常有帮助。

标签: cordova braintree


【解决方案1】:

这样对我有用:

  1. 把这个放在head标签里面:

    <script src="https://js.braintreegateway.com/web/dropin/1.4.0/js/dropin.min.js"></script>
    
  2. 添加这个标签,只是结束body标签:

    <div id="payment-form"></div>  
    
  3. 在控制器中调用 BraintreeService 和 $window。

现在一切都应该正常了。

祝你好运!

【讨论】:

    猜你喜欢
    • 2016-10-14
    • 2017-09-07
    • 2016-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-25
    相关资源
    最近更新 更多