Undo restock if refund fails

Topic summary

Issue: Selecting “restock” during a refund flow causes inventory to be returned to stock even when the refund ultimately fails. The requester wants a way to undo (reverse) the restock if the refund cannot be completed.

Context: Implementation follows Shopify’s docs using the GraphQL mutations refundSessionResolve (to resolve a refund) and refundSessionReject (to reject). Refund requests are processed via a queued job with up to 18 retries over 24 hours.

Edge case: Some payment methods do not support refunds. In these cases, the refund fails after all retries, but the product quantity remains restocked, leading to inaccurate inventory.

Ask: Is there an API or workflow to revert/undo restocked quantities when a refund fails, or otherwise prevent restocking until the refund is confirmed?

Status: No responses or solution provided yet; the question remains open. The linked Shopify documentation was referenced for the implementation details.

Summarized with AI on February 3. AI used: gpt-5.

We are implementing refund as per the following article. We are using refundSessionResolve to resolve the refund and refundSessionReject to reject the refund. In this flow, we observed that if we select restock and the refund fails then the product will be restocked.

https://shopify.dev/apps/payments/processing-a-refund#resolve-a-refund

For context, after we successfully processed the refund request, we can resolve it by using the refundSessionResolve mutation.
We are putting job in a queue and if it fails for some reason, we try for 18 times within 24 hours.

We have a situation where the refund fails even after 24 hours and 18 retries because the payment method do not support refund.
The refund won’t be a success But the quantity will be restocked. Is there a way to undo the restock of quantity when the refund fails?