Interview practice question
Payment events must not be double-processed
System Design · Messaging and Queues · Intermediate
A consumer reads "payment captured" events and credits users' wallets. Duplicates would give free money. How do you design it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Assume duplicates.
- Idempotency key: event/payment ID.
- Unique constraint in the wallet ledger.
- Update ledger and record event ID in one transaction.
- Commit offset after.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.