Overview
A coupon is a code your students enter at checkout to get a discount. Each coupon is owned by its creator (createdById) and visible only to that account's analytics — institutions and tutors can't see each other's coupons.
Creating a coupon
- Open Tutor dashboard → Coupons → New coupon.
- Enter a
code— uppercased automatically on save. e.g.EARLY50. - Pick a
typeandvalue(see below). - Optionally restrict to a single
batchId. - Optionally set
maxUses,validFrom,validUntil. - Click Create.
EARLY50 can only be used by one creator. A 409 response means someone already owns that code — pick another.Coupon types
| Type | Value | Meaning |
|---|---|---|
PERCENT | 1–100 | Discount = price × value / 100. Cannot exceed 100%. |
FIXED_INR | any positive integer | Discount = value rupees, capped at the item price (cannot make total negative). |
Scoping to a batch
Leave batchId empty for a coupon that works on any of your batches. Set it to a specific batch to lock the coupon to that batch alone — useful for "Only for JEE Batch 2026" promotions.
Course-wide or path-wide scoping isn't supported yet; for now, scope per batch and create multiple coupons if you want the same code to apply across several batches.
Usage limits & validity
maxUses— null means unlimited. Otherwise the coupon stops validating once_count.usages >= maxUses.validFrom— defaults to creation time. Set in the future for an embargoed launch.validUntil— null means no expiry. Otherwise the coupon stops validating after this timestamp.
How a coupon is validated at checkout
When a student enters a coupon at checkout, the server calls POST /api/coupons/validate with the code and the target batch ID. The server checks:
- Code exists and is active.
- If
batchIdis set on the coupon, it matches the target. - Current time is within
validFrom↔validUntil. maxUsesisn't exhausted.- The student hasn't already used this coupon (one use per student per coupon).
On success, the discount value is returned and applied to the order. On failure, a clear error is returned ("Coupon expired", "Coupon already used", etc.).
Tracking usage
Open any coupon to see:
- Total uses so far (
_count.usages). - List of usages — student name, batch, discount applied, timestamp.
- Remaining uses if
maxUsesis set.
Coupons are immutable after creation: to change the value or validity, deactivate the existing one and create a new code.