Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal Refund Rest Api v2 - Authorization failed due to insufficient permissions

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"
        }
    ]
}
like image 502
Sumeet Avatar asked Feb 27 '19 14:02

Sumeet


2 Answers

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.

like image 62
Karan Afuwale Avatar answered Sep 28 '22 09:09

Karan Afuwale


Creating a new application with a new set of client ID and secret worked for me.

like image 20
iwooli Avatar answered Sep 28 '22 08:09

iwooli