首先,我没有商业帐户,所以如果这是问题,请告诉我,因为几乎不可能在他们的官方网站上找到 Paypal Express Checkout 的要求。
我的这个 API 的代码是:
$requestParams = array(
'METHOD' => $method,
'VERSION' => $this -> _version,
'USER' => $PayPalApiUsername,
'PWD' => $PayPalApiPassword,
'SIGNATURE' => $PayPalApiSignature
);
$request = array_merge($requestParams, $params);
//$params is bringed from other php.
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL ,'https://api-3t.paypal.com/nvp');
curl_setopt($ch,CURLOPT_VERBOSE ,1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER ,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST ,false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER ,1);
curl_setopt($ch,CURLOPT_HTTPGET ,true);
curl_setopt($ch,CURLOPT_POSTFIELDS ,$request);
$response = curl_exec($ch);
然后,直到这里(我认为)没问题。但是做一些检查,这是我用 $request 发送的:
$request: array(16) {
["METHOD"]=>
string(18) "SetExpressCheckout"
["VERSION"]=>
string(4) "97.0"
["USER"]=>
string(27) "xxx_api1.example.com"
["PWD"]=>
string(16) "yyyyyyyyyyyyyyyy"
["SIGNATURE"]=>
string(56) "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
["RETURNURL"]=>
string(50) "http%3A%2F%2Fwww.website.com%2Fcontinue.php"
["CANCELURL"]=>
string(53) "http%3A%2F%2Fwww.website.com%2Fpaypal%2Fcancel_url.php"
["PAYMENTREQUEST_0_AMT"]=>
string(5) "10.95"
["PAYMENTREQUEST_0_CURRENCYCODE"]=>
string(3) "EUR"
["PAYMENTREQUEST_0_ITEMAMT"]=>
string(5) "10.95"
["PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID"]=>
string(24) "xxx%40example.com"
["PAYMENTREQUEST_0_PAYMENTACTION"]=>
string(4) "Sale"
["L_PAYMENTREQUEST_0_NAME0"]=>
string(17) "ProductA"
["L_PAYMENTREQUEST_0_AMT0"]=>
string(5) "10.95"
["L_PAYMENTREQUEST_0_QTY0"]=>
string(1) "1"
["L_PAYMENTREQUEST_0_NUMBER0"]=>
string(1) "1"
}
这是我从 Paypal 收到的:
$response:
TIMESTAMP=2013%2d01%2d07T23%3a20%3a43Z
CORRELATIONID=7a8130fb32e44
ACK=Failure
L_ERRORCODE0=10001
L_SHORTMESSAGE0=Internal%20Error
L_LONGMESSAGE0=Timeout%20processing%20request
有谁知道这里发生了什么?这是错的吗?首要帐户是这里的问题吗?