贝宝发送自定义字段与快速结账

时间:2017-10-04 12:32:53

标签: php paypal paypal-ipn paypal-rest-sdk

我想在paypal的快速​​结账时发送一个自定义字段,这样我就可以在从paypal发回IPN时收到相同内容。这在文档中没有明确定义,我被困在这里。这是我的代码:

 paypal.Button.render({

                env: 'production', // sandbox | production

                // PayPal Client IDs - replace with your own
                // Create a PayPal app: https://developer.paypal.com/developer/applications/create
                client: {
                    sandbox:    'my sandbox client ID here',
                    production: 'my client ID here'
                },

                // Show the buyer a 'Pay Now' button in the checkout flow
                commit: true,

                // payment() is called when the button is clicked
                payment: function(data, actions) {

                    // Make a call to the REST api to create the payment
                    return actions.payment.create({
                        payment: {
                            transactions: [
                                {
                                    amount: { total: '1', currency: 'GBP' }
                                }
                            ]
                        }
                    });
                },

                // onAuthorize() is called when the buyer approves the payment
                onAuthorize: function(data, actions) {

                    // Make a call to the REST api to execute the payment
                    return actions.payment.execute().then(function() {
                        console.log(data);

                        //my action here

                    });
                }

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

我只能发送金额和货币,但无法弄清楚如何发送自定义字段。

0 个答案:

没有答案