2012-10-09 47 views
0

IM,我已經花了幾個晚上讀書,但即時要麼不理解發生了什麼或即時得到一些錯誤somehwereGET的transactionId從DoExpressCheckoutPayment回覆遇到麻煩事務ID加上從doexpresscheckoutpayment回覆其他信息

這裏的一些代碼

function ConfirmPayment($FinalPaymentAmt) 
{ 

    //Format the other parameters that were stored in the session from the previous calls 
    $token    = urlencode($_SESSION['TOKEN']); 
    $paymentType  = urlencode($_SESSION['PaymentType']); 
    $currencyCodeType = urlencode($_SESSION['currencyCodeType']); 
    $payerID   = urlencode($_SESSION['payer_id']); 

    $serverName   = urlencode($_SERVER['SERVER_NAME']); 

    $nvpstr = '&TOKEN=' . $token . '&PAYERID=' . $payerID . '&PAYMENTREQUEST_0_PAYMENTACTION=' . $paymentType . '&PAYMENTREQUEST_0_AMT=' . $FinalPaymentAmt; 
    $nvpstr .= '&PAYMENTREQUEST_0_CURRENCYCODE=' . $currencyCodeType . '&IPADDRESS=' . $serverName; 

    /* Make the call to PayPal to finalize payment 
     If an error occured, show the resulting errors 
     */ 
    $resArray=hash_call("DoExpressCheckoutPayment",$nvpstr); 

    /* Display the API response back to the browser. 
     If the response from PayPal was a success, display the response parameters' 
     If the response was an error, display the errors received using APIError.php. 
     */ 
    $ack = strtoupper($resArray["ACK"]); 

    return $resArray; 
} 

然後

$resArray = ConfirmPayment($finalPaymentAmount); 
$ack = strtoupper($resArray["ACK"]); 
if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") { 

    $transactionId = $resArray["TRANSACTIONID"]; // ' Unique transaction ID of the payment. Note: If the PaymentAction of the request was Authorization or Order, this value is your AuthorizationID for use with the Authorization & Capture APIs. 
    $transactionType = $resArray["TRANSACTIONTYPE"]; //' The type of transaction Possible values: l cart l express-checkout 
    $paymentType = $resArray["PAYMENTTYPE"]; //' Indicates whether the payment is instant or delayed. Possible values: l none l echeck l instant 
    $orderTime = $resArray["ORDERTIME"]; //' Time/date stamp of payment 

等等等等

的doexprescheoutpayment工作,它確實完成支付寶付款,它只是$ TRANSACTIONID和其他人總是空的,我想記錄這些

可以some1點我在正確的方向

感謝 克雷格

+0

在你的'if'條件下,你有沒有嘗試拋棄'$ resArray'的內容來確保你得到你期望的結果?記錄或電郵結果。 – Josh

+0

不錯的主意,會爲我節省很多時間 –

回答

2

根據PayPal's DoExpressCheckoutPayment API操作文檔:自63.0版本

TRANSACTIONID已被棄用。改爲使用 PAYMENTINFO_n_TRANSACTIONID。

同樣,PAYMENTTYPETRANSACTIONTYPE,和ORDERTIME被棄用。檢查提供的鏈接以獲取響應消息中已更新的變量名稱。

+0

非常感謝你,我的愚蠢的錯誤,但謝謝你指着我在正確的方向,我的代碼似乎確定現在已經改變了折舊的東西 –

+0

沒問題!有時候只需要一點幫助。 – Josh