无法在离子应用程序

时间:2017-03-17 18:11:02

标签: angularjs ionic-framework paypal

我正在使用Paypal Express Checkout与Ionic App集成,当我在按钮点击时测试chrome而不是Android手机上的.apk时,Paypal客户端API正在打开。搜索了一下之后,我遇到了InAPP Browser Cordova插件,它打开了浏览器。

如何将InApp浏览器与Paypal API集成是我面临的问题,因为Inappbrowser需要url,而Paypal API有自己的脚本,打开页面上的按钮点击。

paypal.Button.render({

    env: 'sandbox', // Optional: specify 'sandbox' environment

    client: {
        sandbox:    'key-secret',
        production: 'xxxxxxxxx'
    },

    payment: function() {

        var env    = this.props.env;
        var client = this.props.client;

        return paypal.rest.payment.create(env, client, {
            transactions: [
                {
                    amount: { total: '1.00', currency: 'USD' }
                }
            ]
        });
    },

    commit: true, // Optional: show a 'Pay Now' button in the checkout flow

    onAuthorize: function(data, actions) {

        // Optional: display a confirmation page here

        return actions.payment.execute().then(function() {
            // Show a success page to the buyer
        });
    }

}, '#paypal-button');

打开网址的Inappbrowser代码是:

 $cordovaInAppBrowser.open('url(want to open paypal here)', '_blank', options)

  .then(function(event) {
     // success
  })

  .catch(function(event) {
     // error
  });  

Paypal Button“我希望它在此按钮上打开Inappbrowser中的Paypal API”

 <div id="paypal-button"></div>

0 个答案:

没有答案