PayPal客户端?多个按钮所需的最低代码是多少?

时间:2017-01-18 10:24:07

标签: paypal

我正在使用.Net,试图实现多个按钮。

我从PayPal(付款ID,付款人ID等)获得答案,但一切都是客户端的。如何检查服务器端的付款?

我是否需要为每个按钮实现所有这些代码?

<script>
paypal.Button.render({

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

    client: {
        sandbox:    'xxxxxxxxx',
        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');
</script>

1 个答案:

答案 0 :(得分:0)