medium

Design a Coupon and Discount System

Design a discount and coupon engine. Include percentage, fixed-amount, and buy-one-get-one discount types, coupon validation, stackable discount rules, and usage limits.

Suggested time: 45 minutes

Loading the workspace...

About this problem

A coupon system sounds simple: enter a code, get a discount. But underneath, the system must support multiple discount types (percentage, fixed, BOGO), enforce thread-safe redemption limits when thousands of users race for the same coupon, compose decorators for capping and flooring, and chain discounts in configurable order. Let's break this down.

What your design needs to cover

  • Apply Discount to Cart

  • Create and Validate Coupons

  • Enforce Usage Limits

  • Stack and Combine Discounts

Key challenges the editorial covers

Learn from other designs

Related problems

Guides