【发布时间】:2020-05-06 14:26:17
【问题描述】:
我正在尝试发送批量付款,为此我使用了 CURL,但我收到错误响应:You do not have permissions to make this API call,
我的凭据是正确的。这是我的完整代码:
$unsername = '****';
$password = '****';
$signature = '****';
$personal_email = '****@gmail.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $unsername
. "&".$password
. "&".$signature
. "&METHOD=MassPay"
. "&VERSION=90"
. "&RECEIVERTYPE=EmailAddress"
. "&CURRENCYCODE=USD"
. "&L_EMAIL0=".$personal_email
. "&L_AMT0=35.95");
$headers = array();
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
$result = urldecode($result);
$data = parse_str($result,$responseArray);
$jsonResponse = $responseArray;
echo "<pre>";
print_r($jsonResponse);
die;
回应:
Array
(
[TIMESTAMP] => 2020-01-20T14:41:52Z
[CORRELATIONID] => f1f011edab2bd
[ACK] => Failure
[VERSION] => 90
[BUILD] => 54022052
[L_ERRORCODE0] => 10002
[L_SHORTMESSAGE0] => Authentication/Authorization Failed
[L_LONGMESSAGE0] => You do not have permissions to make this API call
[L_SEVERITYCODE0] => Error
)
【问题讨论】:
-
您可能需要检查您帐户中的 API 权限或联系 PayPal 了解此问题,因为这是权限问题,而不是代码问题。
-
你能帮我在需要添加权限的地方吗
标签: paypal paypal-sandbox