Sanjaay Gowda T S
Amazon.com, Inc. practice

ORIGINAL COMPANY-CONTEXT PRACTICE

Reserve scarce stock without overselling

System designHardConcept

Original practice scenario: Design a hypothetical marketplace checkout for a product with ten units and heavy concurrent demand. Customers can abandon checkout, retry payment and cancel orders.

Written for independent practice using company context; this is not a verified question from a company interview.

A REASONED APPROACH

Model answer.

Separate stock reservation, payment and order confirmation into explicit states. The inventory invariant must hold under concurrent attempts and repeated callbacks, not just a successful checkout sequence.

Work through it

  1. Use an authoritative per-item quantity with atomic conditional reservation; assign each checkout attempt a stable reservation identity and expiration.
  2. Record payment outcomes idempotently and define compensation when payment succeeds after the reservation expires or fulfillment becomes impossible.
  3. Release expired or cancelled reservations through a recoverable process and reconcile inventory, orders and payments using durable state transitions.

Tradeoffs to discuss

  • Long reservations reduce customer frustration but hide stock from other shoppers; short reservations increase availability while complicating slow payments.

Common pitfalls

  • A client-side countdown is not an authoritative expiration decision.
  • Do not refund or release twice when cancellation, timeout and payment notifications race with each other.

KEEP PRACTISING

Related questions.

Keep learning beyond the interview.

Explore the Learning Hub