PayPal Express Checkout.js - 发送自定义参数

PayPal Express Checkout.js - send custom parameters

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

我已经通过paypal官网document,但是找不到怎么发送?

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

<!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>    

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

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

希望这对开发者有所帮助。

发票编号使用:

      payment: {
                    transactions: [
                        {
                            amount: {
                                    total: '200',
                                    currency: 'BRL'
                            },
                            invoice_number: 100

                        }
                    ]
                }