Refund Sales - Broken

SaimonSL
Contributor
Contributor

The refund sales was working back in July 2017. It suddenly stopped working a while ago with the PayPal server (sandbox) returning JSON

 

{
    "name": "UNKNOWN_ERROR",
    "message": "An unknown error occurred.",
    "information_link": "https://developer.paypal.com/docs/api/payments/#errors",
    "debug_id": "1b6bd04ec9623"
}

I am using "Ruby On Rails" with the gem "paypal-sdk-rest" (https://github.com/paypal/PayPal-Ruby-SDK)

and the code sample from "https://developer.paypal.com/docs/api/quickstart/refund-payment/" (Ruby)

 

sale = Sale.find("2DR54130GR056373W")

refund = sale.refund({
  :amount => {
    :total => "1.31",
    :currency => "USD"
  }
})

and it used to work but no longer. I always get that same unknown json error as mentioned at top. It finds the sale and does the refund call to the PayPal server (sandbox) but the server returns same error for all sales.

 

I though it could be the gem itself and tried the curl command in bash (Linux) to see if it will work

 

curl -v -X POST https://api.sandbox.paypal.com/v1/payments/sale/2DR54130GR056373W/refund \
-H "Content-Type:application/json" \
-H "Authorization: Bearer A21AAE4CsSFgafPbfjosLCaCJRpZuwnfItGbRrPFHsr....(hiding the rest)" \
-d '{
  "amount": {
  "total": "2.34",
  "currency": "USD"
  },
  "invoice_number": "INV-489520398743"
}'

and still same error message "UNKNOWN_ERROR" for any sales I choose.

 

The other curl call works where I can create payment and get redirect url. Same goes for gem "paypal-sdk-rest" where I can do everything else like create order and get redirect url. I think the refund system in PayPal is just broken after the site update this year.

 

Can some one verify this using sandbox PayPal.

 

The steps I took were
1. Using developer.paypal.com create an account "buyer" as personal.
2. Using developer.paypal.com create an account "seller" as business.
3. Using developer.paypal.com create an App and linked it to "buyer".
4. Then get that Apps secret and client ID etc...
5. Is Rails web application purchase something using "buyer" account.
6. Then later on 1 day later I login sandbox.paypal.com using "buyer" account and I can see my order there.
7. Then I login as "seller" and I can see the orders there as well.
8. Now I check to match transaction_id which matches with the order I see logged in as "seller"
9. Now in Rails web application I try to do a refund and I get that "UNKNOWN_ERROR" even though I logged in as "buyer", and in different browser logged in as "seller" and looking at the order right now.

 

Now the main account is a business account which we have been using since 2014 and have over thousnads of sales in production and still do till today.

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.