我正在尝试将nvp API用于ExpressCheckout,
我在我的php页面中设置了这个:
$userPaypal = "****";
$passPaypal = "****";
$signaturePaypal = "*****";
$params = array(
'METHOD' => 'SetExpressCheckout',
'VERSION' => '202.0',
'USER' => $userPaypal,
'SIGNATURE' => $signaturePaypal,
'PWD' => $passPaypal,
'RETURNURL' => 'process.php',
'CANCELURL' => 'cancel.php',
'PAYMENTREQUEST_0_AMT' => '10',
'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR');
$params = http_build_query($params);
$endpoint = 'https://api-3t.sandbox.paypal.com/nvp';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $endpoint,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_VERBOSE => 1
));
$response = curl_exec($curl);
$responseArray = array();
parse_str($response, $responseArray);
var_dump($responseArray);
curl_close($curl);
这就是var_dump给我的东西:
array(size = 9)
'TIMESTAMP'=> string'2015-12-17T17:05:44Z'(长度= 20)
'CORRELATIONID'=>字符串'287a4dff68c2f'(长度= 13)
'ACK'=>字符串'失败'(长度= 7)
'VERSION'=>字符串'202.0'(长度= 5)
'BUILD'=>字符串'18308778'(长度= 8)
'L_ERRORCODE0'=>字符串'10002'(长度= 5)
'L_SHORTMESSAGE0'=>字符串'安全错误'(长度= 14)
'L_LONGMESSAGE0'=>字符串'安全标头无效' (长度= 28)
'L_SEVERITYCODE0'=>字符串'错误'(长度= 5)
有没有人知道如何解决“安全标头无效”问题?
谢谢, 罗宾。
答案 0 :(得分:1)
此错误表示API凭据不正确。请仔细检查您的API凭据,并确保您没有使用paypal live API凭据进行沙盒API。