无法从快速结账中获取Paypal交易ID

时间:2013-04-27 07:12:46

标签: php paypal express-checkout

我在这里使用快速结账,但我无法从以下代码获得Paypal transaction_id(收据中显示的那个):

    $httpParsedResponseAr = $paypal->PPHttpPost('DoExpressCheckoutPayment', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);

    //Check if everything went ok..

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {

  if(isset($httpParsedResponseAr["L_TRANSACTIONID0"])){
  $pay->transaction_id = $httpParsedResponseAr["L_TRANSACTIONID0"];
  }

$ httpParsedResponseAr [“L_TRANSACTIONID0”])这应该是问题所在。我一直在寻找Paypal的API几个小时,并尝试了5种不同的东西,但仍然无法让它工作。

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

您是否尝试过打印PayPal的全部回报?我使用NVP API测试:

TOKEN=EC-1HY00019TK493783V
SUCCESSPAGEREDIRECTREQUESTED=false
TIMESTAMP=2013-04-27T20:09:05Z
CORRELATIONID=c2fceba2812b1
ACK=Success
VERSION=87.0
BUILD=5817241
INSURANCEOPTIONSELECTED=false
SHIPPINGOPTIONISDEFAULT=false
PAYMENTINFO_0_TRANSACTIONID=73D205616H9478136
PAYMENTINFO_0_TRANSACTIONTYPE=expresscheckout
PAYMENTINFO_0_PAYMENTTYPE=instant
PAYMENTINFO_0_ORDERTIME=2013-04-27T20:09:04Z
PAYMENTINFO_0_AMT=15.15
PAYMENTINFO_0_FEEAMT=0.74
PAYMENTINFO_0_TAXAMT=0.00
PAYMENTINFO_0_CURRENCYCODE=USD
PAYMENTINFO_0_PAYMENTSTATUS=Completed
PAYMENTINFO_0_PENDINGREASON=None
PAYMENTINFO_0_REASONCODE=None
PAYMENTINFO_0_PROTECTIONELIGIBILITY=Eligible
PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE=ItemNotReceivedEligible,UnauthorizedPaymentEligible
PAYMENTINFO_0_ERRORCODE=0
PAYMENTINFO_0_ACK=Success

在我看来,PAYMENTINFO_0_TRANSACTIONID就是您实际需要的变量。