Make Wholesale Order Placement Idempotent Under Client Retries

Last updated: November 29, 2026

Quick Overview

Design and implement an order placement handler that accepts a client-supplied idempotency key so that a retailer's retried checkout request (after a timeout or a double tap) never creates a duplicate wholesale order. Cover concurrent duplicates, mismatched payloads and failures mid-request.

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

0

0

0 solved


Design and implement an order placement handler that accepts a client-supplied idempotency key so that a retailer's retried checkout request (after a timeout or a double tap) never creates a duplicate wholesale order. Cover concurrent duplicates, mismatched payloads and failures mid-request.

Duplicate orders on a wholesale marketplace are expensive: a brand ships twice, the retailer is billed twice on net terms, and support has to unwind it. The interviewer checks that you know the idempotency key pattern, the race between two in-flight duplicates, and what to do when the side effect fails partway.

What the Interviewer Expects
  • Scope keys per retailer and store the request fingerprint with the key
  • Return the stored response for a completed duplicate
  • Reject a reused key with a different payload
  • Handle two concurrent requests with the same key without double-creating
  • Clear or mark the record on failure so retries can proceed
  • Mention TTL and durable storage with a unique constraint
Key Topics to Cover
idempotency keys
concurrency control
retries
API design
unique constraints
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 do you implement this across many app servers with a relational database?
  • What if order creation succeeds but the response write fails?
  • How long should keys live and how do you expire them?
  • How would downstream calls, such as charging a card for a non-terms order, stay idempotent?
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

place_order(retailer_id, idem_key, payload) must create at most one order per (retailer_id, idem_key). Same key plus same payload returns the original result; same key plus a different payload is a ...

High-Level Design

Store an idempotency record keyed by (retailer_id, key) with status, request hash and response. Claiming a key is an atomic insert: in a database this is an INSERT against a unique index, so exactly...


Submit Your Answer
Markdown supported

Related Questions