LAUNCH50) that redeems a coupon.
Concepts
Coupon
The template. Defines:- Discount:
percent(1-100%) oramount(fixed paisa off) - Duration:
once(next invoice only),repeating(N cycles), orforever - Caps:
maxRedemptions,redeemByexpiry - Scope:
appliesToPlanIds(nullable = all plans)
Promotion code
A public handle pointing at a coupon. Has its own independent limits:maxRedemptionsexpiresAtminimumAmount(order floor in paisa)customerIdsrestriction
LAUNCH50 vs WELCOME50).
Creating a coupon
Creating a promotion code
Validating before applying
{ valid: true, coupon, promotion_code, discount_preview } or { valid: false, reason }. This is read-only and safe to call on every keystroke.
Applying to a subscription
couponId directly to skip the promo-code layer.
Duration semantics
Redemption atomicity
Coupon and promotion code counters update atomically against the redemption cap - racing N parallel applies can never exceed it. The N-1 losers get an error like"Promotion code redemption limit reached". Safe to retry.
Invoice math
When an invoice is generated for a subscription with an active discount, PayBridgeNP emits line items in this order:- Subscription (plan amount, positive)
- Discount (coupon discount, negative)
- Tax (VAT on the discounted amount - see Tax guide)