Refunding with Admin REST API - order status doesn't change (only product gets removed from order)

Refunding with Admin REST API - order status doesn't change (only product gets removed from order)

aandrei
New Member
4 0 0

I'm using the Shopify Admin REST API (as documented at https://help.shopify.com/en/api/reference/orders/refund) to refund items from an order.

 

The API calls (POST /admin/orders/<order_id>/refunds/calculate.json, followed by POST /admin/orders/1985144127624/refunds.json) succeed (only unexpected thing being an empty refund_line_items in the return to /calculate).

 

But the problem is the order's status does not change to "refunded" - even if we refund the only product. What happens is that:

  • the product gets removed from the order (as seen in Shopify Admin)
  • a Refund IS created in Shopify (as seen by the /admin/orders/<order_id>/refunds.json API).

 

Has anyone else encountered this issue or something similar before? Does anyone know of a workaround?

 

Reply 1 (1)

_JB
Shopify Staff (Retired)
836 100 223

Hey @aandrei,

 

The refund you created didn't include a refund transaction, so on that order the product was restocked but no money was returned to the customer. The payment status will only change if money is returned to the customer.

 

When you create the refund, make sure to include a refund transaction as outlined in the examples here. Once you include a refund transaction which references the original sale transaction, you should see the order payment status update as expected. 

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog