paypal IPN获得买方交易ID

时间:2011-09-14 15:52:47

标签: paypal paypal-ipn

我需要与交易相对应的买方交易ID,PayPal通过IPN通知我。 我正在使用

$_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] => myemail@gmail.com
    [quantity] => 1
    [verify_sign] => 123232jh4i32u4u3h5n435i43u5455645
    [payer_email] => payermail@gmail.com
    [txn_id] => 123u4324324yuy4574
    [payment_type] => instant
    [btn_id] => 35428120
    [last_name] => lastname
    [receiver_email] => receiver@gmail.com
    [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
)

2 个答案:

答案 0 :(得分:4)

从paypal发回的变量列表的外观来看,没有买方交易ID。

另一种选择:

通常当您将订单信息发送到PayPal时,您可以包含发票/订单号,如果需要,买方可以按您的发票号码搜索其历史记录(与按交易ID搜索的方式相同)当您将信息发送到PayPal时,请将其包括在内。

答案 1 :(得分:1)

您可以使用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