Payment system design thumb rules:
• Idempotency key on every request, retries never double charge
• Append-only ledger, no balance edits
• Payment status = state machine, not a bool
• Reconcile with the gateway daily
Learned it here 👇
youtu.be/rT4sS4l51PY#SystemDesign
Thumb rule for payments:
HTTP request : can happen multiple times.
Payment operation : should happen only once.
Idempotency key : connects every retry to that same payment.
#SystemDesign#Backend