PERMISSION_DENIED. You do not have permission to access or perform operations on this resource.
bon23
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Oct-29-2023
07:33 PM
I have successfully initiated a payment via sandbox.
Login and paid. I got the results from PayPal
Then request the checkout/orders/orderId via my php backend
I get You do not have permission to access or perform operations on this resource
// use the orders api to capture payment data
private function validatePaypalOrder($payment)
{
try {
$accessToken = $this->getAccessToken($payment);
if (!empty($accessToken)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $payment['orderApiUrl'] . '/' . $this->orderId);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSLVERSION, 6); //NEW ADDITION
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Bearer ' . $accessToken));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
//$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$result = json_decode(curl_exec($ch), true);
//if ($httpCode !== 200) {
// throw new Exception('Error: ' . $result);
//}
Yii::error($result, 'payOrderResulsts');
if (empty($result))
throw new BadRequestHttpException('No paypal order data userId [' . Yii::$app->user->identity->userNumber . ']');
else {
$jsonDecode = json_decode($result);
Yii::error($jsonDecode, 'OrderData');
$this->completeTransaction($payment, $jsonDecode);
}
curl_close($ch);
}
} catch (\Exception $ex) {
return $ex->getMessage();
}
}
Again I successfully get the token using my api credentials but getting orders details fails.
0 REPLIES 0

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- PERMISSION_DENIED error for checkout/orders/{order_id} endpoint in REST APIs
- PERMISSION_DENIED trying to refund capture in live mode in REST APIs
- Status 403 Authorization error in REST APIs
- PERMISSION_DENIED | Billing Subscriptions | LIVE API in REST APIs
- Change the button from Sandbox to Production in REST APIs