Skip to main content
POST
Go (SDK)

Authorizations

Authorization
string
header
required

You can generate an Organization Access Token from your organization's settings.

Body

application/json

Create a subscription for an existing customer.

product_id
string<uuid4>
required

The ID of the recurring product to subscribe to. Must be a free product, otherwise the customer should go through a checkout flow.

Example:

"d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23"

customer_id
string<uuid4>
required

The ID of the customer to create the subscription for.

Example:

"992fae2a-2a17-4b7a-8d9e-e287cf90131b"

metadata
Metadata · object

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

Response

Subscription created.

created_at
string<date-time>
required

Creation timestamp of the object.

modified_at
string<date-time> | null
required

Last modification timestamp of the object.

id
string<uuid4>
required

The ID of the object.

amount
integer
required

The amount of the subscription.

Example:

10000

currency
string
required

The currency of the subscription.

Example:

"usd"

recurring_interval
enum<string>
required

The interval at which the subscription recurs.

Available options:
day,
week,
month,
year
Example:

"month"

recurring_interval_count
integer
required

Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on.

status
enum<string>
required

The status of the subscription.

Available options:
incomplete,
incomplete_expired,
trialing,
active,
past_due,
canceled,
unpaid
Example:

"active"

current_period_start
string<date-time>
required

The start timestamp of the current billing period.

current_period_end
string<date-time>
required

The end timestamp of the current billing period.

trial_start
string<date-time> | null
required

The start timestamp of the trial period, if any.

trial_end
string<date-time> | null
required

The end timestamp of the trial period, if any.

cancel_at_period_end
boolean
required

Whether the subscription will be canceled at the end of the current period.

canceled_at
string<date-time> | null
required

The timestamp when the subscription was canceled. The subscription might still be active if cancel_at_period_end is true.

started_at
string<date-time> | null
required

The timestamp when the subscription started.

ends_at
string<date-time> | null
required

The timestamp when the subscription will end.

ended_at
string<date-time> | null
required

The timestamp when the subscription ended.

customer_id
string<uuid4>
required

The ID of the subscribed customer.

product_id
string<uuid4>
required

The ID of the subscribed product.

discount_id
string<uuid4> | null
required

The ID of the applied discount, if any.

checkout_id
string<uuid4> | null
required
customer_cancellation_reason
enum<string> | null
required
Available options:
customer_service,
low_quality,
missing_features,
switched_service,
too_complex,
too_expensive,
unused,
other
customer_cancellation_comment
string | null
required
metadata
object
required
customer
SubscriptionCustomer · object
required
product
Product · object
required

A product.

discount
DiscountFixedOnceForeverDurationBase · object
required
prices
(LegacyRecurringProductPriceFixed · object | LegacyRecurringProductPriceCustom · object | LegacyRecurringProductPriceFree · object | ProductPriceFixed · object | ProductPriceCustom · object | ProductPriceFree · object | ProductPriceSeatBased · object | ProductPriceMeteredUnit · object)[]
required

List of enabled prices for the subscription.

A recurring price for a product, i.e. a subscription.

Deprecated: The recurring interval should be set on the product itself.

meters
SubscriptionMeter · object[]
required

List of meters associated with the subscription.

pending_update
PendingSubscriptionUpdate · object | null
required

Pending subscription update that will be applied at the beginning of the next period. If null, there is no pending update.

seats
integer | null

The number of seats for seat-based subscriptions. None for non-seat subscriptions.

custom_field_data
Custom Field Data · object

Key-value object storing custom field values.