Getting Not Authorized on API Call
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am trying to make a call to Paypal's REST API to list transactions. I am using PHP, have a business account, have created a new app in developer portal and I do get back an access token from my token call. I take that access token and make a call with that token in header as the documentation states. It returns this error:
{"name":"NOT_AUTHORIZED","debug_id":"7587f9e973334","message":"Authorization failed due to insufficient permissions.","details":[{"issue":"NOT_AUTHORIZED","description":"Authorization failed due to insufficient permissions."}]}
Here's the code:
$URL_LISTTRX = "https://api-m.paypal.com/v1/reporting/transactions?start_date=2024-01-01T00:00:00-0700&end_date=2024-01-2[Removed. Phone #s not permitted]amp;transaction_status=S&transaction_type=T0002&fields=all&page_size=100&page=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$URL_LISTTRX);
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'GET' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Authorization: Bearer $access_token",
'Content-Type: application/json',
'Accept: application/json'));
$result = curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo $result;
curl_close($ch);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It removed some of the URL above assuming it was a phone number. It assumed wrong. It was only a timestamp.
![Moderator Moderator](https://www.paypalobjects.com/webstatic/icon/pp32.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good day @rightway77
Thank you for posting to the PayPal community.
I would suggest to please contact your website developer or the third party eCommerce support to cross check your using same SANDBOX/LIVE REST API Credentials(Client ID & Secret) while performing the below API calls.
https://developer.paypal.com/api/rest/authentication/
https://developer.paypal.com/api/rest/postman/
Also, If a third-party eCommerce partner is performing API operation on your behalf, you(i.e merchant) should be on-boarded and necessary API permissions should be granted to the Partner(API Caller).
https://developer.paypal.com/docs/multiparty/
https://developer.paypal.com/docs/multiparty/seller-onboarding/
Merchants can manually grant permission to a third-party eCommerce to access specific information in your PayPal account and perform PayPal API operations on your behalf.
Login PayPal.com >> Hover on your name at the top right corner >> Account Settings >> Website payments >> API Access >> Pre-built payment solution >> Grant API permission >> contact your "Third party software eCommerce" for Third Party Permission Username >> enter the username.
Direct link - https://www.paypal.com/cgi-bin/webscr?cmd=_profile-api-grant-authorization
https://developer.paypal.com/api/nvp-soap/paypal-payments-standard/admin/third-party/
If you are still experiencing issues, please create an MTS ticket via the following URL - https://www.paypal-support.com/s/?language=en_US . Please ensure that you provide detailed information and error details when submitting the ticket.
Sincerely,
Kavya
PayPal MTS
If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.
![](/skins/images/B2B4F2E319C12C27ED82F4D376226B72/responsive_peak/images/icon_anonymous_message.png)
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Approval Link for Subscription shows System Error if opened in a browser in Sandbox Environment
- PayOut Authorization ERROR in REST APIs
- Unable to capture payment for order with error 'INVALID_RESOURCE_ID' in Sandbox Environment
- How do I resolve RESOURCE_NOT_FOUND Error? in REST APIs
- Advanced Payments checkbox not showing up in sandbox app after completing the sandbox onboarding in REST APIs