&PAYMENTREQUEST_0_CURRENCYCODE
传递给结帐链接时,它会返回错误
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 )
我做了一切来传递这个错误,但我没有
我确定货币代码是有效的
我必须设置它GBP,但即使设置为USD它的返回错误
如果我删除了这个参数&PAYMENTREQUEST_0_CURRENCYCODE
一切都没问题,但是用美元
如果我将此参数&PAYMENTREQUEST_0_CURRENCYCODE
包含在任何货币代码中,则会返回相同的错误
完整的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));
}
答案 0 :(得分:1)
问题解决了我在url中传递了货币代码,而不是在参数变量
中定义它