Issuing line-items refunds on unsettled transactions

1 0 0

We have a proprietary admin portal from which we can refund line-items using the Shopify API and then correlate voids in our system.


When an Authorize.Net transaction is settled, the line-items are refunded successfully.  However, if a transaction is unsettled (which typically occurs the next day), we're met with a contradictory result:


1. The Shopify API returns an error: (422 Unprocessable Entity) base: The referenced transaction does not meet the criteria for issuing a credit

2. However, the Shopify admin site shows that the line-items were still removed from the transaction.


My assessment is that our system rightfully treats the 422 error as meaning that the line-items were not refunded (we expect an error as meaning that the operation failed completely, not partially).


Subsequent attempts to refund the same line-items result in another error (this matches the result seen in the Shopify admin site): (422 Unprocessable Entity) quantity']: cannot refund more items than were purchased


My expectation is that:

1. we should be able to use a refund operation to cancel line-items on a transaction, even if that transaction is unsettled

2. barring the above, Shopify API refund operations should be transactional (entirely committed, or implicitly rolled back when it returns an error)


How do we achieve this?


Replies 0 (0)