Undo restock if refund fails

aacssh
Shopify Partner
1 0 0

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?
Replies 0 (0)