通过PayPal IPN提供的数据获取PayPal交易ID(使用REST API,而非经典)

时间:2014-07-31 11:46:51

标签: paypal paypal-ipn

PayPal IPN提供以下数据:

  'mc_gross' => '715.80',
  'protection_eligibility' => 'Eligible',
  'address_status' => 'unconfirmed',
  'item_number1' => '',
  'payer_id' => 'UCTG7GEULVxxx',
  'tax' => '0.00',
  'address_street' => 'Pl 2270',
  'payment_date' => '00:35:08 Jul 31, 2014 PDT',
  'payment_status' => 'Completed',
  'charset' => 'windows-1252',
  'address_zip' => '26492',
  'mc_shipping' => '0.00',
  'mc_handling' => '0.00',
  'first_name' => 'Benny',
  'mc_fee' => '8.94',
  'address_country_code' => 'SE',
  'address_name' => 'Benny Andersxxx',
  'notify_version' => '3.8',
  'custom' => '',
  'payer_status' => 'verified',
  'business' => 'paypal@xxx.com',
  'address_country' => 'Sweden',
  'num_cart_items' => '1',
  'mc_handling1' => '0.00',
  'address_city' => 'Klippan',
  'verify_sign' => 'AiJvJDl-VyZzRT4Hq0qB1wSjgCgGAvdLxvQHk79AHsO0AjdeWvSwxxx',
  'payer_email' => 'benny.anderxxx@xxx.com',
  'mc_shipping1' => '0.00',
  'tax1' => '0.00',
  'txn_id' => '1M112630L55146xxx',
  'payment_type' => 'instant',
  'last_name' => 'Andersxxx',
  'address_state' => '_0_',
  'item_name1' => 'Order xxx.com 2014-07-31',
  'receiver_email' => 'paypal@xxx.com',
  'payment_fee' => '',
  'quantity1' => '1',
  'receiver_id' => '4AMCEP9BMPxxx',
  'txn_type' => 'cart',
  'mc_gross_1' => '715.80',
  'mc_currency' => 'EUR',
  'residence_country' => 'SE',
  'transaction_subject' => '',
  'payment_gross' => '',
  'ipn_track_id' => '354021aeaxxx',

是否有可能将上述信息传递给很多其他API交易所需的交易ID?

实际上,我正试图通过这个电话执行退款:

https://api.paypal.com/v1/payments/sale/ {的transactionId} /退款

但是,我仍然在这里错过了正确的ID,同时我没有更多的想法如何收集这个交易ID(我想它应该看起来像“”PAY-PT597110X687430LKGECATA“)....

请记住,我使用的是REST API,而不是经典的API。

编辑:我不知道为什么,但每次我编辑这篇文章并在开头添加“Hello”时,它会在保存后被删除:-(抱歉!

2 个答案:

答案 0 :(得分:0)

在此行找到交易ID

  

' txn_id' => ' 1M112630L55146xxx',

您需要使用REST调用此URL(显示沙箱URL,根据需要调整Live)

https://api.sandbox.paypal.com/v1/payments/refund/1M112630L55146xxx

您可以在API reference

中查看更多详情

答案 1 :(得分:0)

刚从PayPal收到一条消息,退款仅部分可用于REST API。我现在尝试使用Classic API ...

然而,它并没有使用txn_id @Machavity