user2286081
user2286081

Reputation: 181

Error occured while refund payment in paypal

I am trying to refund the completed payment in paypal using the id like "PAY-7TXXXXXXXXXXXXXXX3RA". I got this id by making a payment from android paypal sdkv2. When i make the refund using that response id, i got the following error. Can anyone help me to clear this problem? What id should i have to give in the url?

URL : https://api.sandbox.paypal.com/v1/payments/sale/PAY-7TXXXXXXXXXXXXXXX3RA/refund

Error Response:

{
    "name": "INVALID_RESOURCE_ID",
    "message": "The requested resource ID was not found",
    "information_link": "https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID",
    "debug_id": "b34b00ad00d57"
}

Upvotes: 1

Views: 839

Answers (1)

Matt Jacunski
Matt Jacunski

Reputation: 381

The sale you are trying to refund here is contained within the payment and has a separate ID. If you GET the payment using the PAY-xxx ID, you'll see a related_resources field containing the sale. Use the ID of the sale to refund.

Upvotes: 3

Related Questions