PayBridge NP follows the Stripe model: a coupon is a reusable discount template; a promotion code is a customer-facing string (likeDocumentation Index
Fetch the complete documentation index at: https://docs.paybridgenp.com/llms.txt
Use this file to discover all available pages before exploring further.
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
| Duration | Behavior |
|---|---|
once | Applied to the next invoice only. Deactivated after. |
repeating | Applied for the next durationInCycles invoices. Auto-deactivates. |
forever | Applied to every future invoice until the coupon is deactivated. |
Redemption atomicity
Coupon and promotion code counters update inside the sameUPDATE ... WHERE redeemedCount < maxRedemptions statement - so racing N parallel applies can never exceed the cap. 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, PayBridge emits line items in this order:- Subscription (plan amount, positive)
- Discount (coupon discount, negative)
- Tax (VAT on the discounted amount - see Tax guide)
Webhooks
| Event | When it fires |
|---|---|
coupon.created | Coupon created via API or dashboard. |
coupon.updated / coupon.deleted | Deactivation. |
coupon.expired | Daily sweep deactivates expired coupons. |
promotion_code.redeemed | Each time a promo is applied to a subscription. |
subscription.discount_applied | Coupon attached to a sub. |
subscription.discount_removed | Active discount cleared. |
Disabling the feature
SetCOUPONS_ENABLED=false in the API environment. Coupon CRUD returns 404; invoice generation skips the discount + tax line items (existing subs produce identical invoices to pre-Phase-2).