Я пытаюсь отправить массовый платеж, для этого я использовал 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
)