Customers
post/v1/customers/{customer}/subscriptions

Create a subscription

Creates a new subscription on an existing customer.

Path parameters

NameDescription
customer*

Request body

FieldTypeDescription
add_invoice_itemsarray<object>

A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription. You may pass up to 20 items.

array item fields
FieldTypeDescription
discountableboolean
discountsarray<object>
array item fields
FieldTypeDescription
couponstring
discountstring
promotion_codestring
metadataobject
periodobject
2 nested fields
FieldTypeDescription
end*object
2 nested fields
FieldTypeDescription
timestampinteger (unix-time)
type*string
start*object
2 nested fields
FieldTypeDescription
timestampinteger (unix-time)
type*string
pricestring
price_dataobject
5 nested fields
FieldTypeDescription
currency*string (currency)
product*string
tax_behaviorstring
unit_amountinteger
unit_amount_decimalstring (decimal)
quantityinteger
tax_ratesarray<string> | string
application_fee_percentnumber | string

A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees documentation.

automatic_taxobject

Automatic tax settings for this subscription.

2 nested fields
FieldTypeDescription
enabled*boolean
liabilityobject
2 nested fields
FieldTypeDescription
accountstring
type*string
backdate_start_dateinteger (unix-time)

A past timestamp to backdate the subscription's start date to. If set, the first invoice will contain line items for the timespan between the start date and the current time. Can be combined with trials and the billing cycle anchor.

billing_cycle_anchorinteger (unix-time)

A future timestamp in UTC format to anchor the subscription's billing cycle. The anchor is the reference point that aligns future billing cycle dates. It sets the day of week for week intervals, the day of month for month and year intervals, and the month of year for year intervals.

billing_thresholdsobject | string

Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.

cancel_atinteger (unix-time) | string

A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using proration_behavior. If set during a future period, this will always cause a proration for that period.

cancel_at_period_endboolean

Indicate whether this subscription should cancel at the end of the current period (current_period_end). Defaults to false.

collection_methodstring

Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as active. Defaults to charge_automatically.

currencystring (currency)

Three-letter ISO currency code, in lowercase. Must be a supported currency.

days_until_dueinteger

Number of days a customer has to pay invoices generated by this subscription. Valid only for subscriptions where collection_method is set to send_invoice.

default_payment_methodstring

ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over default_source. If neither are set, invoices will use the customer's invoice_settings.default_payment_method or default_source.

default_sourcestring

ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If default_payment_method is also set, default_payment_method will take precedence. If neither are set, invoices will use the customer's invoice_settings.default_payment_method or default_source.

default_tax_ratesarray<string> | string

The tax rates that will apply to any subscription item that does not have tax_rates set. Invoices created will have their default_tax_rates populated from the subscription.

discountsarray<object> | string

The coupons to redeem into discounts for the subscription. If not specified or empty, inherits the discount from the subscription's customer.

expandarray<string>

Specifies which fields in the response should be expanded.

invoice_settingsobject

All invoices will be billed using the specified settings.

5 nested fields
FieldTypeDescription
account_tax_idsarray<string> | string
custom_fieldsarray<object> | string
descriptionstring
footerstring
issuerobject
2 nested fields
FieldTypeDescription
accountstring
type*string
itemsarray<object>

A list of up to 20 subscription items, each with an attached price.

array item fields
FieldTypeDescription
billing_thresholdsobject | string
discountsarray<object> | string
metadataobject
pricestring
price_dataobject
6 nested fields
FieldTypeDescription
currency*string (currency)
product*string
recurring*object
2 nested fields
FieldTypeDescription
interval*string
interval_countinteger
tax_behaviorstring
unit_amountinteger
unit_amount_decimalstring (decimal)
quantityinteger
tax_ratesarray<string> | string
metadataobject | string

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

off_sessionboolean

Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to false (on-session).

payment_behaviorstring

Controls how Stripe handles the first invoice when payment is required and collection_method=charge_automatically. Subscriptions with collection_method=send_invoice are automatically activated regardless of the first Invoice status.

payment_settingsobject

Payment settings to pass to invoices created by the subscription.

3 nested fields
FieldTypeDescription
payment_method_optionsobject
10 nested fields
FieldTypeDescription
acss_debitobject | string
bancontactobject | string
cardobject | string
customer_balanceobject | string
konbiniobject | string
paytoobject | string
pixobject | string
sepa_debitobject | string
upiobject | string
us_bank_accountobject | string
payment_method_typesarray<string> | string
save_default_payment_methodstring
pending_invoice_item_intervalobject | string

Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling Create an invoice for the given subscription at the specified interval.

proration_behaviorstring

Determines how to handle prorations resulting from the billing_cycle_anchor. If no value is passed, the default is create_prorations.

transfer_dataobject

If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges.

2 nested fields
FieldTypeDescription
amount_percentnumber
destination*string
trial_endstring | integer (unix-time)

Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to end the customer's trial immediately. Can be at most two years from billing_cycle_anchor. See Using trial periods on subscriptions to learn more.

trial_from_planboolean

Indicates if a plan's trial_period_days should be applied to the subscription. Setting trial_end per subscription is preferred, and this defaults to false. Setting this flag to true together with trial_end is not allowed. See Using trial periods on subscriptions to learn more.

trial_period_daysinteger

Integer representing the number of trial period days before the customer is charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. See Using trial periods on subscriptions to learn more.

trial_settingsobject

Settings related to subscription trials.

1 nested field
FieldTypeDescription
end_behavior*object
1 nested field
FieldTypeDescription
missing_payment_method*string

Response

FieldTypeDescription
applicationstring | application | deleted_application

ID of the Connect Application that created the subscription.

application_fee_percentnumber

A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.

automatic_tax*subscription_automatic_tax
3 nested fields
FieldTypeDescription
disabled_reasonstring

If Stripe disabled automatic tax, this enum describes why.

enabled*boolean

Whether Stripe automatically computes tax on this subscription.

liabilityconnect_account_reference

The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.

billing_cycle_anchor*integer (unix-time)

The reference point that aligns future billing cycle dates. It sets the day of week for week intervals, the day of month for month and year intervals, and the month of year for year intervals. The timestamp is in UTC format.

billing_cycle_anchor_configsubscriptions_resource_billing_cycle_anchor_config

The fixed values used to calculate the billing_cycle_anchor.

billing_mode*subscriptions_resource_billing_mode

The billing mode of the subscription.

3 nested fields
FieldTypeDescription
flexiblesubscriptions_resource_billing_mode_flexible

Configure behavior for flexible billing mode

type*string

Controls how prorations and invoices for subscriptions are calculated and orchestrated.

updated_atinteger (unix-time)

Details on when the current billing_mode was adopted.

billing_schedules*array<subscriptions_resource_billing_schedules>

Billing schedules for this subscription.

array item fields
FieldTypeDescription
applies_toarray<subscriptions_resource_billing_schedules_applies_to>

Specifies which subscription items the billing schedule applies to.

bill_until*subscriptions_resource_billing_schedules_bill_until
key*string

Unique identifier for the billing schedule.

billing_thresholdssubscription_billing_thresholds

Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period

cancel_atinteger (unix-time)

A date in the future at which the subscription will automatically get canceled

cancel_at_period_end*boolean

Whether this subscription will (if status=active) or did (if status=canceled) cancel at the end of the current billing period.

canceled_atinteger (unix-time)

If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with cancel_at_period_end, canceled_at will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state.

cancellation_detailscancellation_details

Details about why this subscription was cancelled

collection_method*string

Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as active.

created*integer (unix-time)

Time at which the object was created. Measured in seconds since the Unix epoch.

currency*string (currency)

Three-letter ISO currency code, in lowercase. Must be a supported currency.

customer*string | customer | deleted_customer

ID of the customer who owns the subscription.

customer_accountstring

ID of the account representing the customer who owns the subscription.

days_until_dueinteger

Number of days a customer has to pay invoices generated by this subscription. This value will be null for subscriptions where collection_method=charge_automatically.

default_payment_methodstring | payment_method

ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over default_source. If neither are set, invoices will use the customer's invoice_settings.default_payment_method or default_source.

default_sourcestring | bank_account | card | source

ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If default_payment_method is also set, default_payment_method will take precedence. If neither are set, invoices will use the customer's invoice_settings.default_payment_method or default_source.

default_tax_ratesarray<tax_rate>

The tax rates that will apply to any subscription item that does not have tax_rates set. Invoices created will have their default_tax_rates populated from the subscription.

array item fields
FieldTypeDescription
active*boolean

Defaults to true. When set to false, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.

countrystring

Two-letter country code (ISO 3166-1 alpha-2).

created*integer (unix-time)

Time at which the object was created. Measured in seconds since the Unix epoch.

descriptionstring

An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.

display_name*string

The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.

effective_percentagenumber

Actual/effective tax rate percentage out of 100. For tax calculations with automatic_tax[enabled]=true, this percentage reflects the rate actually used to calculate tax based on the product's taxability and whether the user is registered to collect taxes in the corresponding jurisdiction.

flat_amounttax_rate_flat_amount

The amount of the tax rate when the rate_type is flat_amount. Tax rates with rate_type percentage can vary based on the transaction, resulting in this field being null. This field exposes the amount and currency of the flat tax rate.

id*string

Unique identifier for the object.

inclusive*boolean

This specifies if the tax rate is inclusive or exclusive.

jurisdictionstring

The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice.

jurisdiction_levelstring

The level of the jurisdiction that imposes this tax rate. Will be null for manually defined tax rates.

livemode*boolean

If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.

metadataobject

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

object*string

String representing the object's type. Objects of the same type share the same value.

percentage*number

Tax rate percentage out of 100. For tax calculations with automatic_tax[enabled]=true, this percentage includes the statutory tax rate of non-taxable jurisdictions.

rate_typestring

Indicates the type of tax rate applied to the taxable amount. This value can be null when no tax applies to the location. This field is only present for TaxRates created by Stripe Tax.

statestring

ISO 3166-2 subdivision code, without country prefix. For example, "NY" for New York, United States.

tax_typestring

The high-level tax type, such as vat or sales_tax.

descriptionstring

The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.

discounts*array<string | discount>

The discounts applied to the subscription. Subscription item discounts are applied before subscription discounts. Use expand[]=discounts to expand each discount.

ended_atinteger (unix-time)

If the subscription has ended, the date the subscription ended.

id*string

Unique identifier for the object.

invoice_settings*subscriptions_resource_subscription_invoice_settings
5 nested fields
FieldTypeDescription
account_tax_idsarray<string | tax_id | deleted_tax_id>

The account tax IDs associated with the subscription. Will be set on invoices generated by the subscription.

custom_fieldsarray<invoice_setting_custom_field>

A list of up to 4 custom fields to be displayed on the invoice.

descriptionstring

An arbitrary string attached to the object. Often useful for displaying to users.

footerstring

Footer to be displayed on the invoice.

issuer*connect_account_reference
items*object

List of subscription items, each with an attached price.

4 nested fields
FieldTypeDescription
data*array<subscription_item>

Details about each object.

array item fields
FieldTypeDescription
billed_untilinteger (unix-time)

The time period the subscription item has been billed for.

billing_thresholdssubscription_item_billing_thresholds

Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period

created*integer

Time at which the object was created. Measured in seconds since the Unix epoch.

current_period_end*integer (unix-time)

The end time of this subscription item's current billing period.

current_period_start*integer (unix-time)

The start time of this subscription item's current billing period.

discounts*array<string | discount>

The discounts applied to the subscription item. Subscription item discounts are applied before subscription discounts. Use expand[]=discounts to expand each discount.

id*string

Unique identifier for the object.

metadata*object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

object*string

String representing the object's type. Objects of the same type share the same value.

price*price
quantityinteger

The quantity of the plan to which the customer should be subscribed.

subscription*string

The subscription this subscription_item belongs to.

tax_ratesarray<tax_rate>

The tax rates which apply to this subscription_item. When set, the default_tax_rates on the subscription do not apply to this subscription_item.

has_more*boolean

True if this list has another page of items after this one that can be fetched.

object*string

String representing the object's type. Objects of the same type share the same value. Always has the value list.

url*string

The URL where this list can be accessed.

latest_invoicestring | invoice

The most recent invoice this subscription has generated over its lifecycle (for example, when it cycles or is updated).

livemode*boolean

If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.

managed_paymentssmor_resource_managed_payments

Settings for Managed Payments for this Subscription and resulting Invoices and PaymentIntents.