CHARGEBACKS

A dispute is a state machine with a clock on every state

L216 MINMONEY
PREDICT

Emeka's bank files a chargeback on his ₦85,000 payment to Ojaline, and the acquirer takes ₦85,000 from Ojaline. The next day Bisi in support refunds ₦85,000 from Emeka's ticket. The bank then rules for Emeka. How much has Ojaline paid back?

A chargeback is the cardholder’s bank reversing a payment. The acquirer debits the amount from the merchant at once and passes it to the issuer; a win reverses the debit. The merchant accepts or sends evidence (a representment). The issuer can reject that and open pre-arbitration; then the scheme arbitrates. The dispute ends won or lost, and every stage that waits on someone has a deadline.

One processor’s guide says cardholders typically get 120 days to dispute and merchants usually 7 to 21 days to respond, depending on the network. Visa and Mastercard rules add pre-arbitration and arbitration stages; some processors stop before arbitration, and the same guide says Stripe does not support that phase. The rules differ and change, so the sim’s window is an illustrative parameter.

▶ SIMULATION
design · dayone disputed flag · day 0
Ojaline's recorddisputed = false · reversals booked ₦0
at the acquirerdebited by the dispute ₦0 · refunded ₦0 · Ojaline out of pocket ₦0 on a ₦85,000 sale
last events—
✓ Ojaline pays back at most once: refunds + the dispute debit ≤ ₦85,000✓ reversals in the books = the acquirer's dispute debit✓ no response late, no dispute lost by a missed deadline
SCHEDULE
01[OPS]OPS: disputes stored as a disputed flag; evidence at the weekly review; refunds unaware
02[ACQUIRER]ACQUIRER: day 0, Emeka pays Ojaline ₦85,000 for a phone; captured and settled
03[SUPPORT]SUPPORT: day 12, Emeka writes in: the screen arrived cracked; ticket opened
04[ISSUER]ISSUER: day 14, Emeka’s bank files a chargeback; the acquirer takes ₦85,000 from Ojaline; response due in WINDOW days
05[SUPPORT]SUPPORT: day 15, Bisi works the ticket: refund ₦85,000
06[OPS]OPS: send evidence (the courier’s signed delivery photo): flag design at its weekly review, day 28; machine from the due-date queue, day 16
07[ISSUER]ISSUER: day 40, the issuer rejects the response: pre-arbitration, new deadline WINDOW days on
08[OPS]OPS: answer the pre-arbitration: flag design at its weekly review, day 42; machine day 41
09[ISSUER]ISSUER: day 75, the issuer upholds Emeka’s claim; Ojaline does not take it to arbitration
10[OPS]OPS: report
Start of one "disputed" flag scenario. 10 steps.
// any dispute notice
on('dispute.*', (n) => {
  order.disputed = true;
  ledger.book('chargeback', -n.amount);   // a pre-arbitration notice books it again
});
// the refund button never reads order.disputed
// evidence goes in when someone runs the weekly "disputed orders" report

Watch the three invariants. In ONE “DISPUTED” FLAG, Ojaline pays back at most once goes red the moment Bisi’s refund lands on top of the chargeback, and reversals in the books = the acquirer's dispute debit goes red when the pre-arbitration notice books ₦85,000 again. Shrink the window and no response late goes red too. FIX: DISPUTE STATE MACHINE refuses the refund, answers from a due-date queue on day 16, and keeps one debit through pre-arbitration. FIX: ACCEPT, DON’T REFUND shows the right way to give the money back.

The double booking here is a state bug, not a retry: the pre-arbitration notice is a new, different message. Duplicate deliveries of the same notice are the idempotency lesson, and the payment’s own states before a dispute, up to capture and refund, are authorise, capture, refund. Inquiries mostly come from American Express and Discover; the same guide says Visa and Mastercard no longer use that phase.

BREAK IT NOT YET

The flag design answers disputes at a weekly review of disputed orders, on day 28 and day 42. Shrink the response window until the review misses the deadline. Then switch the sim to FIX: DISPUTE STATE MACHINE with the same window.

GOAL: the flag design loses the dispute by a missed deadline

FIX IT NOT YET

Rewrite handle as the dispute state machine in the code tab. Return true if the event is accepted, false if not (and change nothing but the state). A chargeback debits its amount once (held); a pre-arbitration keeps the same debit. Evidence counts only if ev.day <= d.dueDay; any event that arrives after the due day of a chargeback or pre_arbitration first moves it to lost. A win returns the debit (held back to 0). Refunds are refused from chargeback onwards unless the dispute was won, and refunded + held never exceeds the amount.

Mental model:

A dispute is one record per dispute moving through chargeback, representment, pre-arbitration and arbitration to won or lost. The merchant is debited once, when it opens, and credited back only on a win. Every waiting state carries a due date as data, and missing it is a loss. While it is open, the dispute is the only way money goes back: never a refund on the side.

IN PRODUCTION

Any merchant or platform that takes cards: marketplaces, wallets funded by card, subscriptions, travel. You meet it as dispute webhooks from the processor, a disputes queue in the back office, a refund button that must check for an open dispute, and a reconciliation where chargeback debits and reversals have to match the acquirer's statement. Card schemes also watch each merchant's dispute rate and put merchants with too many disputes into monitoring programmes.

IN INTERVIEWS

“Design dispute handling for a payments platform.” Draw the states and who moves each one (issuer, merchant, scheme), store the deadline on each waiting state and alert from a queue ordered by it, book the debit once per dispute id, block refunds while a dispute is open and offer accept instead, and keep the evidence attached to the dispute so a response goes out in one submission.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.

USED IN

Chapters that build on this lesson.