A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hey guys 🙂
We are using the Shopify Graph QL API to import order data and their refunds. When an Order contains a refund we are sending an additional request to retrieve its refund items. However, it appears that for partial refunds the refund id is set on the order level but when fetching the actual items using that refund id no refund items are returned.
Has anyone experienced this behaviour and can point me to how items of partial refunds can be retrieved?
This sound a lot like an issue that I coped with yesterday.
Although using the Admin REST API and not the GraphQL API, the concept should be the same.
After careful analysis of what happened in my case, it seems to be as follows:
When creating a refund, there can be two cases:
Case 1: money can be refunded immediately
Case 2: money can not be refunded immediately (in my case it seemed to be that the Shopify-Payments balance of my client was insufficient to cover the refund)
Case 1:
In the first case, all will be as expected. Only one refund is created and the refund contains both the transaction (in terms of: money got refunded) and the refunded line-items.
Case 2:
In the second case however, Shopify splits the whole thing up in two separate refunds:
Refund 1:
Gets issued immediately.
This refund contains:
- the refunded line-items
- no transaction(s)
- a positive discrepancy (with a value of all the refund line items combined) to reflect that, although line-items were refunded, no money was refunded.
Refund 2:
Gets issued after the money was refunded (in case of my client as soon as the balance of Shopify-Payments was sufficient to cover the refund - which therefor can be hours (possibly even days later)). This refund contains:
- no refunded line-items (as these are already refunded in Refund 1)
- transaction(s) for the actual refund
- a negative discrepancy to accommodate that, although the value of line-items is 0,00, still there was money refunded.
So that is, at least in my case, how it can come to refunds without line-items.