PayPal Express Checkout.js-发送自定义参数 [英] PayPal Express Checkout.js - send custom parameters

查看:71
本文介绍了PayPal Express Checkout.js-发送自定义参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将自定义参数发送到新的Paypal Express结帐.成功发送全额付款后,我需要发送booking_id并获得相同的付款.

How I can send a custom parameter to new Paypal Express checkout. I need to send the booking_id and get the same after success full payment.

我已经查看了贝宝官方的文档,但找不到我们怎么发送?

I have gone through the paypal official document, but can't found how we can send?

请看下面是我的文件代码:

Please see below is my file code:

<!DOCTYPE html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <script src="https://www.paypalobjects.com/api/checkout.js"></script>
</head>
<body>
    <div id="paypal-button-container"></div>
    <script>
        paypal.Button.render({
            env: 'sandbox', // sandbox | production
            client: {
                sandbox:    'AYbCnvobq09Ptmsd1TRp3019CMrSTyaAmrHNv6ox0jl86H9OZFmGCPqHqqfPtqpTYTiIuy_e5UGnclMw',
                //production: '<insert production client id>'
            },
            commit: true,
            payment: function(data, actions) {
                return actions.payment.create({
                    payment: {
                        transactions: [
                            {
                                amount: { total: '0.01', currency: 'USD' }
                            }
                        ]
                    }
                });
            },
            onAuthorize: function(data, actions) {
                return actions.payment.execute().then(function() {
                    window.alert('Payment Complete!');
                });
            }
        }, '#paypal-button-container');
    </script>
</body>    

推荐答案

我已经解决了问题,我们可以在付款方式中传递参数.像下面的代码:

I have solved issues, we can pass the parameters in the payment method. like the below code:

payment: function(data, actions) {
    return actions.payment.create({
        payment: {
            transactions: [
                {
                    amount: { total: '10', currency: 'USD' },
                    custom: '1452'
                }
            ]
        }
    });
},

希望这对开发人员有帮助.

Hope this will help for developers.

这篇关于PayPal Express Checkout.js-发送自定义参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆