wtf( )unctionsystem design, drawn
← all problemsPaymentsEasy

Charged for something that never shipped

The checkout takes the money the moment the button is pressed. Then it goes and reserves stock. When the stock is not there — which happens — the order is cancelled and a refund is issued.

Refunds cost a fee, take days to reach the customer, land on a statement as two confusing lines, and every one of them is a support conversation. None of that was necessary. The money did not have to move yet.

Split the payment into the step that reserves the funds and the step that takes them, and put the fulfilment check between them.
Components — tap one, then tap a slot on the diagram
?Taking the money and taking the order are two events. Doing them at once means refunding every time they disagree.

Outside every boundary: Stock check (sometimes fails), Refund (fees, days, support; FAILED: avoidable), Checkout (button pressed), Fulfilment (the goods go out), an empty slot for the before the stock check, an empty slot for the only once it can ship Connections: Checkout calls before the stock check (step 1) before the stock check calls Stock check (step 2) Stock check calls only once it can ship — only if it ships (step 3) only once it can ship calls Fulfilment (step 4) Stock check must NOT reach Refund — no longer needed

Stock checksometimes fails
Refundfees, days, supportavoidable
Checkoutbutton pressed
Fulfilmentthe goods go out