← Lessons

quiz vs the machine

Gold1460

System Design

The Pricing and Promotions Engine

Computing the final price from base prices, rules, coupons, and stacking limits.

5 min read · core · beat Gold to climb

More than a number

A pricing and promotions engine computes the final price a shopper pays. The base price is just the start; on top sit taxes, coupons, percentage discounts, bundles, and loyalty rewards.

Rules and ordering

Promotions are rules: conditions and effects. The order in which they apply matters, because a percentage off then a fixed amount off gives a different total than the reverse. The engine must define a deterministic evaluation order.

Stacking and conflicts

  • Stacking decides whether multiple promotions can combine.
  • Exclusivity marks promotions that cannot be used together.
  • A best price strategy may evaluate several valid combinations and pick the cheapest for the shopper.

Design concerns

  • Keep the engine deterministic and explainable so support can tell a shopper why they paid a price.
  • Recompute at checkout, never trust a price the client sends, to prevent price tampering.

Key idea

Treat promotions as ordered, stackable rules evaluated deterministically and always recompute the final price server side.

Check yourself

Answer to earn rating on the learn ladder.

1. Why does the engine need a deterministic evaluation order?

2. Why recompute price at checkout instead of trusting the client?