You scan a QR code at a shop and pay Rs 500 on UPI. The screen says "Processing..." and then freezes. Your bank says Rs 500 was deducted. The shopkeeper says nothing arrived.
Or you book a train ticket online. The payment is taken, but the ticket never shows up.
Notice the shape: a payment is not one step, but a few steps that only make sense together. Money leaving without arriving is worse than the payment never starting. Next, you will be the bank that has to fix it.
Your goal: every payment must either fully go through or not happen at all. No money may be lost or created.
No right answers here. Just sit with these for a moment.
Each payment was a transaction: a group of steps a database treats as one single piece of work. The rule that protects it is atomicity, which means all or nothing. Either every step happens, or none of them does.
While the steps are in flight, they are only a draft. Pressing Finalise is a commit, which makes everything permanent at once. Reversing, or losing the draft in a crash, is a rollback, as if the payment never started. Banks, ticket sites and shopping apps all work this way.
Atomicity is one of four promises called ACID. The others showed up in your challenges too: consistency (total money never changes and no balance goes below zero), isolation (one payment at a time from the same wallet) and durability (a finalised payment survives a crash).
| The whole payment | Transaction |
| Steps in flight | Uncommitted changes |
| Finalise payment | Commit |
| Reverse, or a crash before finalising | Rollback |
| Total money never changes | Consistency |
| One payment at a time from one wallet | Isolation |
| Finalised payment survives a crash | Durability |
Going back will lose your progress on this page. Are you sure?