Skip to main content
This API allows you to create and manage subscriptions for your account. Subscriptions represent recurring billing arrangements with customers, supporting multiple phases for complex billing scenarios like trials, promotional periods, and plan changes.

The subscription object

string
Unique identifier with sub_ prefix (e.g., sub_abc123def456).
string
The customer’s ID associated with this subscription.
string
How proration is handled: create_prorations, always_invoice, or none.
string
The anchor date for billing cycles (ISO 8601).
string
When the subscription started (ISO 8601).
string
When the subscription ends. null for ongoing subscriptions.
string
When the next invoice will be generated (ISO 8601).
string
The total recurring amount for the subscription.
array
Array of subscription phases.
string
When the subscription was created (ISO 8601).
string
When the subscription was last updated (ISO 8601).

List subscriptions

Retrieves a paginated list of all subscriptions in your account.
integer
default:"1"
Page number for pagination. Results are returned 25 items per page.
Response

Get subscription

Retrieves a specific subscription by ID with all phases and items.
string
required
The subscription’s ID (e.g., sub_abc123def456).
Response

Create subscription

Creates a new subscription with phases and items.
string
required
The customer’s ID. Must belong to your account.
string
default:"create_prorations"
How to handle proration. One of: create_prorations, always_invoice, none.
string
The anchor date for billing cycles (ISO 8601 format).
array
required
Array of phase objects. Must include at least one phase.

Simple subscription

Response

Multi-phase subscription (trial then paid)

Create a subscription with a trial phase followed by a paid phase:

Error responses

Customer not found
Price not found
Missing phases

Update subscription

Updates an existing subscription’s proration behavior or billing cycle anchor.
string
required
The subscription’s ID.
string
How to handle proration. One of: create_prorations, always_invoice, none.
string
The anchor date for billing cycles (ISO 8601 format).
Response

Delete subscription

Cancels and deletes a subscription.
string
required
The subscription’s ID.
Returns 204 No Content on successful deletion.

Proration behavior values

Subscription phases

Subscriptions support multiple phases to handle complex billing scenarios:
  • Trial phases: Free or discounted periods at the start of a subscription.
  • Promotional phases: Temporary discounts or special pricing.
  • Plan changes: Scheduled upgrades or downgrades.
  • Ongoing phases: Indefinite billing with no end date.

Phase rules

All recurring items within a phase must have the same interval (e.g., all monthly). Phases cannot overlap and must be sequential without gaps.
  1. Phases must have at least one item.
  2. All recurring items within a phase must have the same interval.
  3. Phases cannot overlap.
  4. Phases must be sequential without gaps (if an end date is specified).
  5. Only one phase can be active at any time.

Billing cycle anchor

The billing_cycle_anchor determines when recurring invoices are generated:
  • If set, invoices are generated relative to this date.
  • If not set, invoices are generated relative to the subscription start date.
  • Useful for aligning billing to specific dates (e.g., 1st of the month).

Automatic invoice generation

When a subscription is created:
  1. An initial invoice may be generated based on proration behavior.
  2. Recurring invoices are automatically generated on billing dates.
  3. The next_billing_date field shows when the next invoice will be created.

Integration example

Sandbox support

The API respects sandbox scoping. If your API token is associated with a sandbox, you can only access subscriptions created in that sandbox. Subscriptions created in sandbox mode will be isolated from production data.