Make a Money Transfer API Safe to Retry with Idempotency Keys
Last updated: November 29, 2026
Quick Overview
Design and implement an idempotency layer so that a mobile client retrying a transfer request after a timeout never moves money twice, including when duplicate requests arrive concurrently.
Bank of America
November 29, 20260
0
0 solved
Design and implement an idempotency layer so that a mobile client retrying a transfer request after a timeout never moves money twice, including when duplicate requests arrive concurrently.
A fundamentals round for mobile and payments backend teams: BofA app users on flaky networks tap Send again, and a duplicate transfer is a customer harm and a regulatory issue. The interviewer checks you understand at-least-once delivery, request fingerprinting, the in-progress state, and what happens when the handler fails midway.
What the Interviewer Expects
- Client generates a unique key per logical operation and reuses it on retries
- Store key, payload fingerprint, state and response
- Same key and same payload replays the saved response without re-running
- Same key with a different payload is rejected
- Concurrent duplicates get a conflict while the first is in progress
- Discuss persistence and atomicity with the ledger write
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- What happens if the process crashes after debiting but before saving the response?
- How long should keys be retained and why?
- How do you propagate idempotency to a downstream network like Zelle or the ACH operator?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
execute(key, payload, handler) must run handler at most once per key while the key is retained. Retries return the original response. A key reused with a different body is a client bug and must fa...
High-Level Design
A record per key: payload hash, state (IN_PROGRESS or DONE), response, timestamp. Claim the key atomically before doing work; finish by storing the response. In production the claim is an insert with ...