“errorId”:“560022”,“message”:“X-PAYPAL-APPLICATION-ID标头包含无效值”,“参数”:[“X-PAYPAL-APPLICATION-ID”]

时间:2013-11-27 02:33:38

标签: php curl paypal

我没有使用沙箱端点(我已经尝试了沙盒应用程序,但这给了我错误的凭据错误)并且我正在尝试验证付款。

我在PHP中使用以下函数:

function verify_paypal($payKey)
{
  global $payPalUser_Is, $payPalPassword, $payPalSig, $appID;
$headerArray = array(
'X-PAYPAL-SECURITY-USERID:'.$payPalUser_Id,
'X-PAYPAL-SECURITY-PASSWORD:'.$payPalPassword,
'X-PAYPAL-SECURITY-SIGNATURE:'.$payPalSig,
'X-PAYPAL-REQUEST-DATA-FORMAT:JSON',
'X-PAYPAL-RESPONSE-DATA-FORMAT:JSON',
'X-PAYPAL-APPLICATION-ID:'.$appID
);
echo "$headerArray, $appID";
$url="https://svcs.paypal.com/AdaptivePayments/PaymentDetails?payKey={$payKey}&requestEnvelope.errorLanguage=en_US";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray);
$adaptiveResponse = curl_exec($ch);
curl_close($ch);

echo $adaptiveResponse;
//return true or false, still got to handle the response
};

但是它给出了app-id不正确的错误。我使用相同的ID来处理来自android-app的付款没有问题。有谁知道我应该使用哪个ID?

1 个答案:

答案 0 :(得分:0)

REQUEST-DATA应为NV:

$headerArray = array(
'X-PAYPAL-SECURITY-USERID:'.$payPalUser_Id,
'X-PAYPAL-SECURITY-PASSWORD:'.$payPalPassword,
'X-PAYPAL-SECURITY-SIGNATURE:'.$payPalSig,
'X-PAYPAL-REQUEST-DATA-FORMAT:NV',
'X-PAYPAL-RESPONSE-DATA-FORMAT:JSON',
'X-PAYPAL-APPLICATION-ID:'.$appID
);