I am trying send mass payment, for this I have used CURL, but I am getting the error response: You do not have permissions to make this API call
,
My credentials are correct. Here is my full code:
$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;
Response :
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
)
2
Answers
Go to developer.paypal.com .
You should have an application, “Default Application” or some other created name.
Select it and you can change the settings:
(I’m not 100% sure that the highlighted one is the right permission, I never used that functionality)
If you don’t have access to the API settings, you should ask to who provided the API keys to you.
You should not be using the old MassPay API for anything.
Instead, integrate Payouts: https://developer.paypal.com/docs/payouts/
For later use in live, there are prerequistics, which are the same for Payouts as for MassPay: https://developer.paypal.com/docs/payouts/integrate/prerequisites/
(if a live account has been enabled for MassPay it has been enabled for Payouts, and vice-versa, the business toggle is one and the same — but must be requested and approved)