I am able to successfully execute below APIs
/v2/checkout/orders
/v2/checkout/orders/{order_id}/authorize
/v2/checkout/orders/{order_id}/capture
Why am I getting the "NOT_AUTHORIZED" response while executing PayPal refund as described here? - https://developer.paypal.com/docs/api/payments/v2/#captures_refund
POST request
https://api.sandbox.paypal.com/v2/payments/captures/<Capture ID I got from capture request>/refund
Response
{
"name": "NOT_AUTHORIZED",
"message": "Authorization failed due to insufficient permissions.",
"debug_id": "6c6xxxxx6c",
"details": [
{
"issue": "PERMISSION_DENIED",
"field": "capture_id",
"value": "XXXXXXXXX",
"description": "You do not have permission to access or perform operations on this resource.",
"location": "path"
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/v2/payments/#NOT_AUTHORIZED",
"rel": "information_link"
}
]
}
You have to contact the PayPal support to add permission for your existing ClientId and Client secret (which works fine for PayPal V1 APIs) for V2 Refunds and Cancel request and there is no other way you can set the permission for same. If you need to avoid this then Just create new ClientId and Client secret from PayPal accounts and it will work fine with PayPal V2 APIs.
Creating a new application with a new set of client ID and secret worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With