Menu

Refunding an uncaptured auth doesn't release the hold
📰

Refunding an uncaptured auth doesn't release the hold

DEV Community: backend·Payneteasy·8 days ago
#ApqIQNKu
#devtobackend#devto#dev#refund#captured
Reading 0:00
15s threshold

We had a cancel-order flow that called the refund endpoint for everything. Captured payment, refund. Authorized-only payment, also refund. The gateway accepted both calls and returned success, so nobody looked closer.

Then support started getting tickets: "You cancelled my order but the money is still gone from my account." The payments were authorize-only, never captured. The "refund" on an uncaptured auth was being treated by the gateway as a no-op, or in one acquirer's case, as a partial reversal that did not release the hold. The customer's issuer kept the authorization hold for 7 to 10 days, depending on the bank. From the cardholder's side, the money was gone. From ours, the order was cancelled and the ledger showed zero.

The fix was boring. Before cancelling, read the payment state. Authorized and not captured: send a void (reversal). Captured: send a refund. Partially captured: reverse the remainder, refund the rest.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.