This was happening on my live Shopify app, the Calculate Refund API returns a HTTP status 422 Error with message "cannot remove more than the fulfillable quantity." , if I set the "restock_type" of the refund_line_items to "cancel".
But if I set it to "return" , then it returns back a proper response, and the "restock_type" returned in the response is "cancel" !
This workaround works but I am afraid it might mess up inventory of other orders if the response returned back somehow is not "cancel" if I put in "return" as input.
I would be really thankful if any Shopify Staff can look into this issue as this has caused issues to merchants using my app.
The Request ID is 24f742a0-0e64-48ae-9f94-d86fb5d836f8
Spent too much support time dealing with order cancellation request from customer? Wouldn't it be good if customer can cancel order on their own without bugging your support? Try out Cancellable app! https://apps.shopify.com/cancellable . I also write articles about store customization that can improve your customer shopping experience here : Yagi Software Blog