Subscriptions
Overview
Section titled “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, pause/resume, bulk operations, and flexible termination options.
Subscription states
Section titled “Subscription states” ┌──────────┐ │ PENDING │ └────┬──────┘ │ activate ┌────▼──────┐ ┌────│ ACTIVE │◄───┐ │ └──┬────────┘ │ │ │ │ resume cancel│ │ pause │ │ ┌──▼─────┐ │ │ │ PAUSED │──────┘ │ └─────────┘ │ ┌─────▼────┐ ┌────────────┐ │ CANCELED │ │ TERMINATED │ └───────────┘ └────────────┘Any state except terminated can transition to terminated via the terminate (DELETE) endpoint.
| Status | Description |
|---|---|
pending | Created but not yet activated |
active | Currently billing |
paused | Billing suspended; can be resumed |
canceled | Soft-canceled, will terminate at period end |
terminated | Fully ended |
Create a subscription
Section titled “Create a subscription”curl -X POST /v1/subscriptions/ \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "external_id": "sub_001", "customer_id": "cust-uuid", "plan_id": "plan-uuid", "billing_time": "calendar", "pay_in_advance": true, "trial_period_days": 14, "on_termination_action": "generate_invoice" }'Billing time modes
Section titled “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
Section titled “Pay-in-advance vs pay-in-arrear”| Mode | When invoiced | Use case |
|---|---|---|
Pay-in-advance (pay_in_advance: true) | At the start of each billing period | SaaS subscriptions |
Pay-in-arrear (pay_in_advance: false) | At the end of each billing period | Usage-heavy products |
Activate a subscription
Section titled “Activate a subscription”Pending subscriptions must be explicitly activated:
POST /v1/subscriptions/{subscription_id}/activateOnce activated, the subscription moves to active status and started_at is recorded.
Trials
Section titled “Trials”When trial_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)
If pay_in_advance is enabled, the first invoice is generated when the trial ends.
Plan changes
Section titled “Plan changes”Preview a plan change
Section titled “Preview a plan change”Before executing a plan change, preview the financial impact:
POST /v1/subscriptions/{subscription_id}/change_plan_preview{ "plan_id": "new-plan-uuid"}Returns a price comparison and proration details so the customer can review before confirming.
Upgrades (immediate)
Section titled “Upgrades (immediate)”PUT /v1/subscriptions/{subscription_id}{ "plan_id": "new-plan-uuid"}When upgrading with 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)
Section titled “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
Pause and resume
Section titled “Pause and resume”POST /v1/subscriptions/{subscription_id}/pausePausing a subscription suspends billing. The subscription moves to paused status and paused_at is recorded. No invoices are generated while paused.
Resume
Section titled “Resume”POST /v1/subscriptions/{subscription_id}/resumeResuming moves the subscription back to active and records resumed_at.
Cancellation vs termination
Section titled “Cancellation vs termination”Cancel
Section titled “Cancel”POST /v1/subscriptions/{subscription_id}/cancelSoft cancellation — the subscription remains active until the end of the current billing period, then transitions to canceled status.
Terminate
Section titled “Terminate”DELETE /v1/subscriptions/{subscription_id}?on_termination_action=generate_invoiceImmediate termination. The subscription is ended right away.
Termination actions
Section titled “Termination actions”The on_termination_action parameter controls what happens financially when a subscription ends:
| 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 |
This can be set at creation time (as a default) or passed at cancellation/termination.
Bulk operations
Section titled “Bulk operations”Perform operations on multiple subscriptions at once:
| Endpoint | Description |
|---|---|
POST /v1/subscriptions/bulk_pause | Pause multiple subscriptions |
POST /v1/subscriptions/bulk_resume | Resume multiple subscriptions |
POST /v1/subscriptions/bulk_terminate | Terminate multiple subscriptions |
Each returns a BulkSubscriptionResponse with per-subscription results.
Usage and entitlements
Section titled “Usage and entitlements”Current usage
Section titled “Current usage”GET /v1/subscriptions/{subscription_id}/current_usageReturns the current billing-period usage for all metered charges on the subscription.
Usage trend
Section titled “Usage trend”GET /v1/subscriptions/{subscription_id}/usage_trendReturns daily usage trend data for the subscription.
Usage thresholds
Section titled “Usage thresholds”# Create a thresholdPOST /v1/subscriptions/{subscription_id}/usage_thresholds
# List thresholdsGET /v1/subscriptions/{subscription_id}/usage_thresholdsUsage thresholds trigger alerts or actions (e.g., progressive billing) when usage reaches defined amounts.
Entitlements
Section titled “Entitlements”GET /v1/subscriptions/{external_id}/entitlementsReturns the feature entitlements granted by the subscription’s plan.
Next billing date
Section titled “Next billing date”GET /v1/subscriptions/{subscription_id}/next_billing_dateReturns the next billing date for the subscription, useful for displaying to customers.
Lifecycle timeline
Section titled “Lifecycle timeline”GET /v1/subscriptions/{subscription_id}/lifecycleReturns the full lifecycle timeline — a chronological list of events (creation, activation, pauses, plan changes, cancellation, etc.) for audit and debugging.
Charge models
Section titled “Charge models”Each charge on a plan uses one of the following charge models:
| Model | Description |
|---|---|
standard | Fixed price per unit |
graduated | Tiered pricing — different rates for different quantity ranges |
volume | Volume pricing — the tier reached applies to all units |
package | Price per package of units |
percentage | Percentage of a base amount |
graduated_percentage | Tiered percentage rates |
dynamic | Dynamically calculated pricing |
custom | Custom pricing logic |
Webhooks
Section titled “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
Section titled “API endpoints”| Method | Path | Description |
|---|---|---|
GET | /v1/subscriptions/ | List subscriptions |
POST | /v1/subscriptions/ | Create a subscription |
GET | /v1/subscriptions/{subscription_id} | Get subscription details |
PUT | /v1/subscriptions/{subscription_id} | Update a subscription |
DELETE | /v1/subscriptions/{subscription_id} | Terminate a subscription |
POST | /v1/subscriptions/{subscription_id}/activate | Activate a pending subscription |
POST | /v1/subscriptions/{subscription_id}/pause | Pause a subscription |
POST | /v1/subscriptions/{subscription_id}/resume | Resume a paused subscription |
POST | /v1/subscriptions/{subscription_id}/cancel | Cancel a subscription |
GET | /v1/subscriptions/{subscription_id}/lifecycle | Get lifecycle timeline |
GET | /v1/subscriptions/{subscription_id}/next_billing_date | Get next billing date |
POST | /v1/subscriptions/{subscription_id}/change_plan_preview | Preview plan change |
GET | /v1/subscriptions/{subscription_id}/current_usage | Get current usage |
GET | /v1/subscriptions/{subscription_id}/usage_trend | Get usage trend |
POST | /v1/subscriptions/{subscription_id}/usage_thresholds | Create usage threshold |
GET | /v1/subscriptions/{subscription_id}/usage_thresholds | List usage thresholds |
GET | /v1/subscriptions/{external_id}/entitlements | Get entitlements |
POST | /v1/subscriptions/bulk_pause | Bulk pause subscriptions |
POST | /v1/subscriptions/bulk_resume | Bulk resume subscriptions |
POST | /v1/subscriptions/bulk_terminate | Bulk terminate subscriptions |