paypal IPN 获取买家交易 ID
我需要与 PayPal 通过 IPN 通知我的交易相对应的买家交易 ID。 我正在使用
$_POST['txn_id']
,但这存储的是卖方的交易 ID,而不是买方的交易 ID。同时买家无法获取卖家的交易ID。
据我了解,PayPal 分配了两个不同的交易 ID,但卖方需要存储买方交易 ID,以便能够与用户就特定交易进行沟通。
有人知道当 PayPal 向我的 IPN 脚本发送通知时我如何接收(或搜索)买家交易 ID?
我只收到以下数据:
Array
(
[mc_gross] => 7.00
[protection_eligibility] => Ineligible
[payer_id] => F6912JHUIIHA
[tax] => 0.00
[payment_date] => 10:14:55 Sep 11, 2011 PDT
[payment_status] => Completed
[charset] => windows-1252
[first_name] => Name
[mc_fee] => 2.08
[notify_version] => 3.2
[custom] =>
[payer_status] => verified
[business] => [email protected]
[quantity] => 1
[verify_sign] => 123232jh4i32u4u3h5n435i43u5455645
[payer_email] => [email protected]
[txn_id] => 123u4324324yuy4574
[payment_type] => instant
[btn_id] => 35428120
[last_name] => lastname
[receiver_email] => [email protected]
[payment_fee] => 2.08
[shipping_discount] => 0.00
[insurance_amount] => 0.00
[receiver_id] => OIUWDWUERWEU
[txn_type] => web_accept
[item_name] => Product name
[discount] => 0.00
[mc_currency] => USD
[item_number] => PRODNum
[residence_country] => SE
[handling_amount] => 0.00
[shipping_method] => Default
[transaction_subject] => Product to sell
[payment_gross] => 7.00
[shipping] => 0.00
[ipn_track_id] => ydedi23484rl4itm54oi
)
I need the buyer transaction ID that correspond to the transaction PayPal notifies me by IPN.
I'm using
$_POST['txn_id']
but this stores the transaction ID for the seller, not the transaction ID of the buyer. At the same time the buyer hasn't access to the transaction ID of the seller.
I understand that PayPal assign two different transactions ID, but the seller needs to stores the buyer transaction ID in order to be able to communicate with the user about an specific transaction.
Anyone know how I can receive (or search for) the buyer transaction ID when PayPal send a notification to my IPN script?
I only receive the follow data:
Array
(
[mc_gross] => 7.00
[protection_eligibility] => Ineligible
[payer_id] => F6912JHUIIHA
[tax] => 0.00
[payment_date] => 10:14:55 Sep 11, 2011 PDT
[payment_status] => Completed
[charset] => windows-1252
[first_name] => Name
[mc_fee] => 2.08
[notify_version] => 3.2
[custom] =>
[payer_status] => verified
[business] => [email protected]
[quantity] => 1
[verify_sign] => 123232jh4i32u4u3h5n435i43u5455645
[payer_email] => [email protected]
[txn_id] => 123u4324324yuy4574
[payment_type] => instant
[btn_id] => 35428120
[last_name] => lastname
[receiver_email] => [email protected]
[payment_fee] => 2.08
[shipping_discount] => 0.00
[insurance_amount] => 0.00
[receiver_id] => OIUWDWUERWEU
[txn_type] => web_accept
[item_name] => Product name
[discount] => 0.00
[mc_currency] => USD
[item_number] => PRODNum
[residence_country] => SE
[handling_amount] => 0.00
[shipping_method] => Default
[transaction_subject] => Product to sell
[payment_gross] => 7.00
[shipping] => 0.00
[ipn_track_id] => ydedi23484rl4itm54oi
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从paypal发回的变量列表来看,没有买家交易id。
另一种选择:
通常当您将订单信息发送到 PayPal 时,您可以包含发票/订单号,如果需要,买家可以通过您的发票号搜索他的历史记录(与他们通过交易 ID 搜索的方式相同),如果当您将信息发送到 PayPal 时,您将包含该信息。
From the looks of the list of variables paypal sends back, there is no buyer transaction id.
Another option:
Usually when you send your order information to paypal, you can include an invoice/order number, the buyer, if needed, is able to search his history by your invoice number (the same way they would search by transaction id) if you include it when you send the info to paypal.
您可以使用 GetTransactionDetails API 并传入买家的交易 ID。
API 调用示例如下:
METHOD=GetTransactionDetails&
TRANSACTIONID=买家交易ID&
另请参阅:https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails
You can use the GetTransactionDetails API and pass in the buyer's transaction ID.
A sample API call would be:
METHOD=GetTransactionDetails&
TRANSACTIONID=buyers transaction ID&
See also: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails