2011-10-11 139 views
0

IM面臨當我嘗試傳遞參數&PAYMENTREQUEST_0_CURRENCYCODE時結賬鏈接它返回錯誤使用NVP SDK 到SetExpressCheckout一個大問題,當10605錯誤使用內SetExpressCheckout CURRENCYCODE和NVP SDK

SetExpressCheckout failed: Array ( 
[TIMESTAMP] => 2011%2d10%2d11T00%3a58%3a56Z 
[CORRELATIONID] => fa1dd71c19e46 
[ACK] => Failure 
[VERSION] => 82%2e0 
[BUILD] => 2133933 
[L_ERRORCODE0] => 99998 
[L_ERRORCODE1] => 10605 
[L_SHORTMESSAGE0] => Transaction%20refused%20because%20of%20an%20invalid%20argument%2e%20See%20additional%20error%20messages%20for%20details%2e 
[L_SHORTMESSAGE1] => Transaction%20refused%20because%20of%20an%20invalid%20argument%2e%20See%20additional%20error%20messages%20for%20details%2e 
[L_LONGMESSAGE0] => Currency%20is%20not%20supported [L_LONGMESSAGE1] => Currency%20is%20not%20supported 
[L_SEVERITYCODE0] => Error [L_SEVERITYCODE1] => Error) 

我所做的一切通過這個錯誤,但我沒有 確保貨幣代碼是有效的 我必須設置它英鎊,但即使設置爲美元時它的返回錯誤 如果我刪除此參數&PAYMENTREQUEST_0_CURRENCYCODE一切正常,沒有問題,但在美元如果我包含此參數0123,則爲與任何貨幣代碼它返回相同的錯誤 完整的var_dump

array(13) { ["TIMESTAMP"]=> string(28) "2011%2d10%2d13T02%3a55%3a21Z" 
["CORRELATIONID"]=> string(13) "4e167b7f7ec44" 
["ACK"]=> string(7) "Failure" 
["VERSION"]=> string(6) "82%2e0" 
["BUILD"]=> string(7) "2183220" 
["L_ERRORCODE0"]=> string(5) "99998" 
["L_ERRORCODE1"]=> string(5) "10605" 
["L_SHORTMESSAGE0"]=> string(122) "Transaction%20refused%20because%20of%20an%20invalid%20argument%2e%20See%20additional%20error%20messages%20for%20details%2e" 
["L_SHORTMESSAGE1"]=> string(122) "Transaction%20refused%20because%20of%20an%20invalid%20argument%2e%20See%20additional%20error%20messages%20for%20details%2e" 
["L_LONGMESSAGE0"]=> string(31) "Currency%20is%20not%20supported" 
["L_LONGMESSAGE1"]=> string(31) "Currency%20is%20not%20supported" 
["L_SEVERITYCODE0"]=> string(5) "Error" 
["L_SEVERITYCODE1"]=> string(5) "Error" } bool(true) SetExpressCheckout failed: 

這是API請求

$actions .= ' 
&L_PAYMENTREQUEST_0_NAME1=Name Example 
&L_PAYMENTREQUEST_0_NUMBER1=Product Code Example 
&L_PAYMENTREQUEST_0_DESC1=Product Title 
&L_PAYMENTREQUEST_0_AMT1='.number_format(50, 2, '.', '').' 
&L_PAYMENTREQUEST_0_QTY1=1'; 
$paymentAmount = urlencode($sum); 
$ship = urlencode($del); 
$tot = $paymentAmount + $ship ; 
$currencyID = urlencode(GBP);       // or other currency code ('GBP', 'EUR', 'JPY', 'CAD', 'AUD') 
$returnURL = urlencode("http://www.example.net/index.php"); 
$cancelURL = urlencode('http://www.example.net/index.php'); 
$actions .= " 
&PAYMENTREQUEST_0_PAYMENTACTION=Sale 
&PAYMENTREQUEST_0_ITEMAMT=".$paymentAmount." 
&PAYMENTREQUEST_0_SHIPPINGAMT=".$ship." 
&PAYMENTREQUEST_0_AMT=".$tot." 
&PAYMENTREQUEST_0_ALLOWNOTE=1 
&PAYMENTREQUEST_0_CURRENCYCODE=".$currencyID." 
"; 
// Add request-specific fields to the request string. 
$nvpStr = "&$actions&ReturnUrl=$returnURL&CANCELURL=$cancelURL"; 

// Execute the API operation; see the PPHttpPost function above. 
$httpParsedResponseAr = PPHttpPost('SetExpressCheckout', $nvpStr); 

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) { 
    // Redirect to paypal.com. 
    $token = urldecode($httpParsedResponseAr["TOKEN"]); 
    $payPalURL = "https://www.paypal.com/webscr&cmd=_express-checkout&token=$token"; 
    if("sandbox" === $environment || "beta-sandbox" === $environment) { 
     $payPalURL = "https://www.$environment.paypal.com/webscr&cmd=_express-checkout&token=$token"; 
    } 
    header("Location: $payPalURL"); 
    exit; 
} else { 
    exit('SetExpressCheckout failed: ' . print_r($httpParsedResponseAr, true)); 
} 
+1

在將您的完整NVP字符串發送到PayPal的API端點之前,您可以執行var_dump嗎? – Robert

+0

當然我會,並會很快讓你知道結果 – Marco

+0

var_dump添加我認爲它與print_r相同,我已經使用:) – Marco

回答

1

問題解決我通過在URL中的貨幣代碼,而不是在參數定義它變量

+0

請顯示在URL中發送貨幣的示例。 – vladko13

相關問題