Coupons
Coupons provide discounts that are applied to customer invoices during generation.Create a coupon
Coupon types
| Type | Description | Required field |
|---|---|---|
fixed_amount | Fixed monetary discount | amount_cents, amount_currency |
percentage | Percentage off subtotal | percentage_rate |
Frequency
| Frequency | Behavior |
|---|---|
once | Applied to one invoice, then terminated |
recurring | Applied for frequency_duration billing periods |
forever | Applied indefinitely |
Apply a coupon to a customer
- Non-reusable coupons can only be applied to one customer (409 if already used)
- Expired or terminated coupons cannot be applied (400)
- Amount and percentage can be overridden per application
How discounts are calculated
During invoice generation:- All active applied coupons for the customer are retrieved
- Percentage discounts:
discount = subtotal × rate / 100 - Fixed amount discounts:
min(amount_cents, remaining_subtotal) - Discounts are applied sequentially — if the subtotal reaches zero, remaining coupons are skipped
- The total discount is recorded as
coupons_amount_centson the invoice
Terminate a coupon
terminated. Existing applied coupons remain active until consumed.
Add-ons
Add-ons are one-time charges applied to customers. When an add-on is applied, a one-off invoice is generated.Create an add-on
Apply an add-on
- An
AppliedAddOnrecord is created - A one-off invoice is generated with the add-on as a line item
- A fee with
fee_type: add_onis created
amount_cents can be overridden from the default add-on price.
API endpoints
Coupons
| Method | Path | Description |
|---|---|---|
POST | /v1/coupons | Create a coupon |
GET | /v1/coupons | List coupons (filterable by status) |
GET | /v1/coupons/{code} | Get coupon details |
PUT | /v1/coupons/{code} | Update a coupon |
DELETE | /v1/coupons/{code} | Terminate a coupon |
POST | /v1/coupons/apply | Apply coupon to customer |
Add-ons
| Method | Path | Description |
|---|---|---|
POST | /v1/add_ons | Create an add-on |
GET | /v1/add_ons | List add-ons |
GET | /v1/add_ons/{code} | Get add-on details |
PUT | /v1/add_ons/{code} | Update an add-on |
DELETE | /v1/add_ons/{code} | Delete an add-on |
POST | /v1/add_ons/apply | Apply add-on to customer |