Skip to content

๐Ÿท๏ธ Coupons โ€‹

Staff can create discount coupons that customers apply at checkout.

Admin Coupons

๐ŸŽซ Coupon Types โ€‹

TypeBehavior
PERCENTAGE๐Ÿ“Š Discount by percentage (e.g., 10% off)
FIXED๐Ÿ’ต Discount by a fixed amount (e.g., $5 off)
FREE_DELIVERY๐Ÿšš Waive the delivery fee

๐Ÿ“ Coupon Fields โ€‹

FieldDescription
codeUnique coupon code (e.g., WELCOME10)
typePERCENTAGE, FIXED, or FREE_DELIVERY
valueDiscount amount or percentage
minOrderMinimum order subtotal to qualify
maxDiscountCap for percentage discounts
usageLimitMaximum total uses (null = unlimited)
usageCountCurrent number of uses
perCustomerMaximum uses per customer (default: 1)
startsAtStart date (optional)
expiresAtExpiration date (optional)
isActiveEnable/disable the coupon

โœ… Validation Rules โ€‹

When a customer applies a coupon, the system checks:

  1. ๐Ÿ” Code exists and is active
  2. ๐Ÿ“… Date range โ€” current time is between startsAt and expiresAt
  3. ๐Ÿ”ข Usage limit โ€” usageCount < usageLimit
  4. ๐Ÿ‘ค Per-customer limit โ€” customer hasn't exceeded perCustomer uses
  5. ๐Ÿ’ฐ Minimum order โ€” cart subtotal โ‰ฅ minOrder

If validation fails, the API returns a descriptive error message.

๐Ÿ›’ Applying at Checkout โ€‹

POST /api/coupons/validate
{
  "code": "WELCOME10",
  "orderTotal": 25.00
}

Returns the discount amount if valid. The coupon is linked to the order when it's created.

๐Ÿ” Permissions โ€‹

ActionWho Can Do It
โœ… Validate couponAnyone
๐Ÿ“‹ List couponsStaff
โœ๏ธ Create/update couponsStaff
๐Ÿ—‘๏ธ Delete couponsManager, Super Admin

๐Ÿ“ก API โ€‹

See Coupons API for the complete endpoint reference.