Design Coupons and Promotions
MediumSystem design · Commerce
Design a promotions service that applies coupon codes, discounts and campaign rules at checkout. Some codes are limited (for example the first 1,000 uses) and become hot the moment they are shared.
In scope: campaign and eligibility rules, quote versus redemption, atomic usage limits, reservation with expiry, combination and precedence, abuse detection, and cost accounting. Out of scope: the checkout and payment systems themselves.
Requirements
- Eligibility rules, expiry, per-customer limits, global limits and monetary budgets
- No double redemption under concurrency: atomic conditional decrement, idempotent per order
- Quote and redeem are separate; recompute at redemption and reserve with a short expiry until payment succeeds
- Deterministic combination rules, and an auditable record of every redemption and its cost