The payment that arrives too late
transcript
A hold on stock lasts 300 seconds. Then it lets go. The shopper pays at time 400. The order was paid for. Do you ship it?
At time 20, two units are held for the order. At time 320, the hold lapses and releases them. At time 400, the payment finally arrives.
The lapsed hold was released. The units went back to stock. Nothing is set aside for this order any more. Someone else may already own those two units.
Confirming anyway would oversell. The units may be gone. So the order becomes expired. And the caller refunds the money. Late is not an error.
A payment callback can be delivered twice. Networks retry. The second one finds the order already paid. It does nothing. A late callback on an expired order just says refund again.
Confirm checks the clock first. If the hold is gone, refund.
The full design is in the lecture. Plans, expiry, and an order state machine.