0
votes

In order to gracefully handle a refund request on a transaction that has already been refunded, I should have the possibility to check the exact error code returned by PayPal REST API in case of a POST https://api.sandbox.paypal.com/v1/payments/capture/{captureid}/refund request.

similarly to the classic API I thought (but I was wrong) that in this case an error 10009 could be returned (https://developer.paypal.com/docs/classic/api/errorcodes/).

Actually when I try to request a refund for a payment that has already been captured i got a 400 HTTP status and the JSON body below:

{
  "name": "TRANSACTION_REFUSED",
  "message": "The request was refused.This transaction has already been fully refunded",
  "information_link": "https://developer.paypal.com/webapps/developer/docs/api/#TRANSACTION_REFUSED",
  "debug_id": "e3f52374ef2e7"
}

I was wondering if there's a way to to look for this specific error other than inspecting the "message" value included in the JSON response.

Thanks, Andrea

1

1 Answers

0
votes

I believe you already got an answer from the PayPal-Java-SDK GitHub repository issue #148.

In case someone else has the same question, today, the HTTP response code is a general error code, and the message in the body is the best way to identify the cause. Please make a feature request to PayPal Technical Support so this enhancement can be considered for a future release.