【问题标题】:Always empty paypal IPN custom field始终为空 paypal IPN 自定义字段
【发布时间】:2020-06-04 15:56:53
【问题描述】:

我正在尝试像这样发送我的自定义字段(使用沙盒):

paypal.Buttons({

                            createOrder: function(data, actions) {
                                return actions.order.create({
                                    purchase_units: [{
                                        amount: {
                                            value: dataResponse.value
                                        },
                                        custom: 'SOME_DATA',
                                    }]
                                });
                            },

                            // Finalize the transaction
                            onApprove: function(data, actions) {
                                return actions.order.capture().then(function(details) {
                                    // Show a success message to the buyer
                                    alert('Transaction completed by ' + details.payer.name.given_name + '!');
                                });
                            }


                        }).render('#paypal-button-container');

就像我在服务器上得到响应(我使用 paypal/ipn-code-samples):

$data_text = "";
foreach ($_POST as $key => $value) {
    $data_text .= $key . " = " . $value . "\r\n";
}

这就是 IPN 的样子(部分):

paypal_ipn_status = RECEIVER EMAIL MISMATCH
paypal_ipn_date = 2020-02-20 12:20:53 +05
mc_gross = 27.00
protection_eligibility = Eligible
address_status = confirmed
payer_id = 6F3VC36BWPQ7J
address_street = \u0443\u043B\u0438\u0446\u0430 \u041F\u0435\u0440\u0432\u0430\u044F
payment_date = 23:20:41 Feb 19, 2020 PST
payment_status = Completed
charset = KOI8_R
address_zip = 127001
first_name = John
mc_fee = 11.05
address_country_code = RU
address_name = Doe John
notify_version = 3.9
custom = 
payer_status = verified
business = sb-gvgju1033031@business.example.com

谁能告诉我我做错了什么? 谢谢!

【问题讨论】:

  • 实际发送的 HTTP 请求是什么?在不知道 actions.order.create() 到底做了什么的情况下,不可能从中猜到。

标签: paypal paypal-sandbox paypal-ipn


【解决方案1】:

好吧,我发现了一个错误。

而不是这个:

                                return actions.order.create({
                                    purchase_units: [{
                                        amount: {
                                            value: dataResponse.value
                                        },
                                        custom: 'SOME_DATA',
                                    }]
                                });

需要使用这个(prop命名-custom_id):

return actions.order.create({
                                    purchase_units: [{
                                        amount: {
                                            value: dataResponse.value
                                        },
                                        custom_id: 'SOME_DATA',
                                    }]
                                });

现在我终于在 IPN 中获得了我的自定义字段

address_country_code = RU
address_name = Doe John
notify_version = 3.9
custom = SOME DATA

我希望这对某人有所帮助。

【讨论】:

  • 你在哪里找到这个custom_id?我一直使用custom,它一直有效。
  • 好吧,我在这里找到了一些信息 linkcustom_id 道具。但老实说,我并没有完全理解为什么会这样 =\
猜你喜欢
  • 2012-07-23
  • 2014-02-27
  • 2013-01-20
  • 2014-04-19
  • 2014-01-09
  • 2011-11-28
  • 2011-08-27
  • 2017-01-22
相关资源
最近更新 更多