Overview
Subscriptions connect customers to plans and drive the billing lifecycle. BoxBilling supports trials, pay-in-advance/arrear billing, calendar and anniversary billing, plan upgrades/downgrades, and flexible termination options.Subscription states
- Pending — Created but not yet activated
- Active — Currently billing
- Canceled — Soft-canceled, will terminate at period end
- Terminated — Fully ended
Create a subscription
Billing time modes
| Mode | Description |
|---|---|
| Calendar | Billing periods align to calendar boundaries (1st of month, start of week, etc.) |
| Anniversary | Billing periods align to the subscription start date |
Pay-in-advance vs pay-in-arrear
| Mode | When invoiced | Use case |
|---|---|---|
| Pay-in-advance | At the start of each billing period | SaaS subscriptions |
| Pay-in-arrear | At the end of each billing period | Usage-heavy products |
Trials
Whentrial_period_days > 0, the subscription enters a trial period. During the trial:
- No invoices are generated
- The subscription is marked as
active - When the trial ends, the system processes the transition via the
process_trial_expirationsbackground task (runs hourly)
pay_in_advance is enabled, the first invoice is generated when the trial ends.
Plan changes
Upgrades (immediate)
pay_in_advance:
- A credit note is generated for the remaining period on the old plan
- A prorated invoice is generated for the new plan
Downgrades (end of period)
Downgrades are scheduled to take effect at the next billing period boundary:- The
previous_plan_idis set to the new plan downgraded_attimestamp is recorded- The
process_pending_downgradestask (runs daily) executes the switch
Cancellation vs termination
Cancel
canceled status.
Terminate
Termination actions
| Action | Description |
|---|---|
generate_invoice | Generate a final invoice for the period |
generate_credit_note | Issue a credit note for the remaining period |
skip | No financial action taken |
Webhooks
The following webhook events are sent during the subscription lifecycle:| Event | Trigger |
|---|---|
subscription.created | New subscription created |
subscription.started | Subscription activated |
subscription.plan_changed | Plan upgrade or downgrade executed |
subscription.trial_ended | Trial period expired |
subscription.canceled | Subscription canceled |
subscription.terminated | Subscription terminated |
API endpoints
| Method | Path | Description |
|---|---|---|
GET | /v1/subscriptions | List subscriptions |
GET | /v1/subscriptions/{id} | Get subscription details |
POST | /v1/subscriptions | Create a subscription |
PUT | /v1/subscriptions/{id} | Update a subscription |
POST | /v1/subscriptions/{id}/cancel | Cancel a subscription |
DELETE | /v1/subscriptions/{id} | Terminate a subscription |