Sumeet
Sumeet

Reputation: 1799

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"
        }
    ]
}

Upvotes: 7

Views: 6306

Answers (2)

iwooli
iwooli

Reputation: 187

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

Upvotes: 4

Karan Afuwale
Karan Afuwale

Reputation: 91

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.

Upvotes: 9

Related Questions