Make the Peer-to-Peer Transfer Endpoint Idempotent

Last updated: November 29, 2026

Quick Overview

Implement an idempotency layer for a send-money API so that a mobile client retrying the same request with the same idempotency key never moves money twice. Reject key reuse with a different body, signal when the original is still in flight, and decide what happens to the key when the downstream call fails or times out.

Chime
Software Engineering Fundamentals
Software Engineer
Chime
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Medium

0

0

0 solved


Implement an idempotency layer for a send-money API so that a mobile client retrying the same request with the same idempotency key never moves money twice. Reject key reuse with a different body, signal when the original is still in flight, and decide what happens to the key when the downstream call fails or times out.

A fundamentals question in the style of Chime's backend screens, set on a Pay Anyone style transfer where flaky mobile networks make retries common. The interviewer checks whether you understand that a timeout is an unknown outcome, not a failure, and whether your key scoping and locking hold up under concurrency.

What the Interviewer Expects
  • Scope keys per member and fingerprint the request body
  • Use an in-flight state to block concurrent duplicates
  • Replay the stored response for completed requests
  • Release the key only on definite pre-commit failures
  • Keep the key locked on timeouts and resolve via reconciliation
  • Explain where the records live in production and their TTL
Key Topics to Cover
Idempotency Keys
Retries
Concurrency
Exactly-Once Effects
API Design
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you store idempotency records in Postgres so the check and the transfer commit atomically?
  • What TTL would you pick for keys, and why?
  • How does the client generate keys so that a genuine second payment is not blocked?
  • What happens if the process crashes between moving money and saving the response?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

submit(member, key, payload) returns the transfer response. Same key and same body after completion: return the original response without calling downstream. Same key, different body: error (HTTP 42...

High-Level Design

Records keyed by (member, key) hold a body hash, a state (in_flight or done) and the response. The check-and-reserve happens under one lock (in production a unique constraint insert). The downst...


Submit Your Answer
Markdown supported

Related Questions