Paypal快速结账,用于客户端集成

时间:2017-04-15 08:00:25

标签: jquery ios paypal uiwebview express-checkout

我已在网络应用中集成了PayPal客户端快速结账。使用ios Web视图我创建了一个应用程序。现在每当我点击PayPal结账模式时,弹出并立即关闭。我在ios版本10.3及更高版本上遇到了这些问题。 结帐适用于10.3以下设备的所有设备。

请帮我解决问题。

这是代码

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

<script>

// Render the PayPal button

paypal.Button.render({

    // Set your environment

    env: 'sandbox', // sandbox | production

    // PayPal Client IDs - replace with your own
    // Create a PayPal app: https://developer.paypal.com/developer/applications/create

    client: {
        sandbox:    'XXXXXX,
        production: 'XXXXXX'
    },

    // Wait for the PayPal button to be clicked

    payment: function() {

        // Make a client-side call to the REST api to create the payment

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

    // Wait for the payment to be authorized by the customer

    onAuthorize: function(data, actions) {

        // Execute the payment

        return actions.payment.execute().then(function() {
            document.querySelector('#paypal-button-container').innerText = 'Payment Complete!';
        });
    }

}, '#paypal-button-container');

</script>`

1 个答案:

答案 0 :(得分:0)

确保在您的代码中输入您的应用客户端ID:

 client: {
        sandbox:    'AVEqB1ga85Bzn8r8o5cckJN7peyaPgQy1zzH748iCwMGuVQN8jtZP8i0gV5ghuolgJsUe7JoMcjwsqrC,
        production: 'XXXXXX'
 },