如何发送额外数据(例如 UID)作为贝宝快速结账的一部分?

How to send extra data (such as a UID) as part of paypal express checkout?

我是 paypal SDK 的菜鸟,所以请多多包涵。我已经通过沙箱获得了贝宝付款,让 IPN 触发并通过电子邮件回复我。到目前为止,一切都很好。

我正在使用来自贝宝网站的基本集成示例代码(这是付款片段)

   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' }
//what do I put here to pass a custom var called uid?

                                                    }
                                                ]
                                            });
                                        },

我的问题是:如何传递一个额外的参数(除了当前的 amount: { etc currently passed?我有一个我生成的 UID,我想作为参数传递,然后在我的 IPN 侦听器中使用 _POST 获取,以便根据此值验证我的数据库中的条目。但对于我来说,除了上述之外,我找不到任何如何传递参数的示例example 。这里的任何帮助将不胜感激和称赞:)

我认为您正在从这些文档中查找 custom 字段:

https://developer.paypal.com/docs/api/payments/

transactions: [
    {
        amount: { total: '1.00', currency: 'USD' },
        custom: 'xxxxxxx'       
    }
]