Updates an existing subscription schedule.
Parameters
- metadatahash
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
. - phasesarray of hashes
List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the
end_
of one phase will always equal thedate start_
of the next phase. Note that past phases can be omitted.date - phases.
itemsarray of hashesRequired List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
- phases.
items. billing_ thresholdshash Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
- phases.
items. billing_thresholds. usage_ gteintegerRequired Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 monetary threshold)
- phases.
items. discountsarray of hashes The coupons to redeem into discounts for the subscription item.
- phases.
items. discounts. couponstring ID of the coupon to create a new discount for.
- phases.
items. discounts. discountstring ID of an existing discount on the object (or one of its ancestors) to reuse.
- phases.
items. discounts. promotion_ codestring ID of the promotion code to create a new discount for.
- phases.
items. metadatahash Set of key-value pairs that you can attach to a configuration item. Metadata on a configuration item will update the underlying subscription item’s
metadata
when the phase is entered, adding new keys and replacing existing keys. Individual keys in the subscription item’smetadata
can be unset by posting an empty value to them in the configuration item’smetadata
. To unset all keys in the subscription item’smetadata
, update the subscription item directly or unset every key individually from the configuration item’smetadata
. - phases.
items. pricestring The ID of the price object.
- phases.
items. price_ datahash Data used to generate a new Price object inline.
- phases.
items. price_data. currencyenumRequired Three-letter ISO currency code, in lowercase. Must be a supported currency.
- phases.
items. price_data. productstringRequired - phases.
items. price_data. recurringhashRequired The recurring components of a price such as
interval
andinterval_
.count - phases.
items. price_data. recurring. intervalenumRequired Specifies billing frequency. Either
day
,week
,month
oryear
.Possible enum valuesday
month
week
year
- phases.
items. price_data. recurring. interval_ countinteger The number of intervals between subscription billings. For example,
interval=month
andinterval_
bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).count=3
- phases.
items. price_data. tax_ behaviorenumRecommended if calculating taxes Only required if a default tax behavior was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of
inclusive
,exclusive
, orunspecified
. Once specified as eitherinclusive
orexclusive
, it cannot be changed.Possible enum valuesexclusive
inclusive
unspecified
- phases.
items. price_data. unit_ amountinteger A positive integer in cents (or 0 for a free price) representing how much to charge.
- phases.
items. price_data. unit_ amount_ decimalstringRequired conditionally Same as
unit_
, but accepts a decimal value in cents with at most 12 decimal places. Only one ofamount unit_
andamount unit_
can be set.amount_ decimal
- phases.
items. quantityinteger Quantity for the given price. Can be set only if the price’s
usage_
istype licensed
and notmetered
. - phases.
items. tax_ ratesarray of strings A list of Tax Rate ids. These Tax Rates will override the
default_
on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.tax_ rates
- phases.
add_ invoice_ itemsarray of hashes A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items.
- phases.
add_invoice_items. discountsarray of hashes The coupons to redeem into discounts for the item.
- phases.
add_invoice_items. discounts. couponstring ID of the coupon to create a new discount for.
- phases.
add_invoice_items. discounts. discountstring ID of an existing discount on the object (or one of its ancestors) to reuse.
- phases.
add_invoice_items. discounts. promotion_ codestring ID of the promotion code to create a new discount for.
- phases.
add_invoice_items. metadatahash 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
. - phases.
add_invoice_items. periodhash The period associated with this invoice item. If not set,
period.
defaults tostart. type max_
anditem_ period_ start period.
defaults toend. type min_
.item_ period_ end - phases.
add_invoice_items. period. endhashRequired End of the invoice item period.
- phases.
add_invoice_items. period. end. typeenumRequired Select how to calculate the end of the invoice item period.
Possible enum valuesmin_
item_ period_ end The minimum
current_
of all underlying subscription items whose periods overlap this phaseperiod_ end phase_
end End of the phase
timestamp
Custom timestamp to use for the end of the invoice item period
- phases.
add_invoice_items. period. end. timestamptimestamp A precise Unix timestamp for the end of the invoice item period. Must be greater than or equal to
period.
.start
- phases.
add_invoice_items. period. starthashRequired Start of the invoice item period.
- phases.
add_invoice_items. period. start. typeenumRequired Select how to calculate the start of the invoice item period.
Possible enum valuesmax_
item_ period_ start The maximum
current_
of all underlying subscription items whose periods overlap this phaseperiod_ start phase_
start Start of the phase
timestamp
Custom timestamp to use for the start of the invoice item period
- phases.
add_invoice_items. period. start. timestamptimestamp A precise Unix timestamp for the start of the invoice item period. Must be less than or equal to
period.
.end
- phases.
add_invoice_items. pricestring The ID of the price object. One of
price
orprice_
is required.data - phases.
add_invoice_items. price_ datahash Data used to generate a new Price object inline. One of
price
orprice_
is required.data - phases.
add_invoice_items. price_data. currencyenumRequired Three-letter ISO currency code, in lowercase. Must be a supported currency.
- phases.
add_invoice_items. price_data. productstringRequired - phases.
add_invoice_items. price_data. tax_ behaviorenumRecommended if calculating taxes Only required if a default tax behavior was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of
inclusive
,exclusive
, orunspecified
. Once specified as eitherinclusive
orexclusive
, it cannot be changed.Possible enum valuesexclusive
inclusive
unspecified
- phases.
add_invoice_items. price_data. unit_ amountinteger A positive integer in cents (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer.
- phases.
add_invoice_items. price_data. unit_ amount_ decimalstringRequired conditionally Same as
unit_
, but accepts a decimal value in cents with at most 12 decimal places. Only one ofamount unit_
andamount unit_
can be set.amount_ decimal
- phases.
add_invoice_items. quantityinteger Quantity for this item. Defaults to 1.
- phases.
add_invoice_items. tax_ ratesarray of strings The tax rates which apply to the item. When set, the
default_
do not apply to this item.tax_ rates
- phases.
application_ fee_ percentfloatConnect only 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.
- phases.
automatic_ taxhash Automatic tax settings for this phase.
- phases.
automatic_tax. enabledbooleanRequired Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
- phases.
automatic_tax. liabilityhashConnect only 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.
- phases.
automatic_tax. liability. typeenumRequired Type of the account referenced in the request.
Possible enum valuesaccount
Indicates that the account being referenced is a connected account which is different from the account making the API request but related to it.
self
Indicates that the account being referenced is the account making the API request.
- phases.
automatic_tax. liability. accountstringRequired only if type is account The connected account being referenced when
type
isaccount
.
- phases.
billing_ cycle_ anchorenum Can be set to
phase_
to set the anchor to the start of the phase orstart automatic
to automatically change it if needed. Cannot be set tophase_
if this phase specifies a trial. For more information, see the billing cycle documentation.start Possible enum valuesautomatic
phase_
start - phases.
billing_ thresholdshash Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
- phases.
billing_thresholds. amount_ gteinteger Monetary threshold that triggers the subscription to advance to a new billing period
- phases.
billing_thresholds. reset_ billing_ cycle_ anchorboolean Indicates if the
billing_
should be reset when a threshold is reached. If true,cycle_ anchor billing_
will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.cycle_ anchor
- phases.
collection_ methodenum Either
charge_
, orautomatically send_
. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing 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 asinvoice active
. Defaults tocharge_
on creation.automatically Possible enum valuescharge_
automatically send_
invoice - phases.
default_ payment_ methodstring ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer’s invoice settings.
- phases.
default_ tax_ ratesarray of strings A list of Tax Rate ids. These Tax Rates will set the Subscription’s
default_
, which means they will be the Invoice’stax_ rates default_
for any Invoices issued by the Subscription during this Phase.tax_ rates - phases.
descriptionstring Subscription 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.
- phases.
discountsarray of hashes The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription’s customer. Pass an empty string to avoid inheriting any discounts.
- phases.
discounts. couponstring ID of the coupon to create a new discount for.
- phases.
discounts. discountstring ID of an existing discount on the object (or one of its ancestors) to reuse.
- phases.
discounts. promotion_ codestring ID of the promotion code to create a new discount for.
- phases.
durationhash The number of intervals the phase should last. If set,
end_
must not be set.date - phases.
duration. intervalenumRequired Specifies phase duration. Either
day
,week
,month
oryear
.Possible enum valuesday
month
week
year
- phases.
duration. interval_ countinteger The multiplier applied to the interval.
- phases.
end_ datetimestamp | string The date at which this phase of the subscription schedule ends. If set,
iterations
must not be set. - phases.
invoice_ settingshash All invoices will be billed using the specified settings.
- phases.
invoice_settings. account_ tax_ idsarray of strings The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
- phases.
invoice_settings. days_ until_ dueinteger Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be
null
for subscription schedules wherebilling=charge_
.automatically - phases.
invoice_settings. issuerhashConnect only The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
- phases.
invoice_settings. issuer. typeenumRequired Type of the account referenced in the request.
Possible enum valuesaccount
Indicates that the account being referenced is a connected account which is different from the account making the API request but related to it.
self
Indicates that the account being referenced is the account making the API request.
- phases.
invoice_settings. issuer. accountstringRequired only if type is account The connected account being referenced when
type
isaccount
.
- phases.
iterationsintegerDeprecated Integer representing the multiplier applied to the price interval. For example,
iterations=2
applied to a price withinterval=month
andinterval_
results in a phase of durationcount=3 2 * 3 months = 6 months
. If set,end_
must not be set. This parameter is deprecated and will be removed in a future version. Usedate duration
instead. - phases.
metadatahash Set of key-value pairs that you can attach to a phase. Metadata on a schedule’s phase will update the underlying subscription’s
metadata
when the phase is entered, adding new keys and replacing existing keys in the subscription’smetadata
. Individual keys in the subscription’smetadata
can be unset by posting an empty value to them in the phase’smetadata
. To unset all keys in the subscription’smetadata
, update the subscription directly or unset every key individually from the phase’smetadata
. - phases.
on_ behalf_ ofstringConnect only The account on behalf of which to charge, for each of the associated subscription’s invoices.
- phases.
proration_ behaviorenum Controls whether the subscription schedule should create prorations when transitioning to this phase if there is a difference in billing configuration. It’s different from the request-level proration_behavior parameter which controls what happens if the update request affects the billing configuration (item price, quantity, etc.) of the current phase.
Possible enum valuesalways_
invoice Prorate changes, and force an invoice to be immediately created for any prorations.
create_
prorations Prorate changes, but leave any prorations as pending invoice items to be picked up on the customer’s next invoice.
none
Does not create any prorations.
- phases.
start_ datetimestamp | string The date at which this phase of the subscription schedule starts or
now
. Must be set on the first phase. - phases.
transfer_ datahashConnect only The data with which to automatically create a Transfer for each of the associated subscription’s invoices.
- phases.
transfer_data. destinationstringRequired ID of an existing, connected Stripe account.
- phases.
transfer_data. amount_ percentfloat 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 destination account. By default, the entire amount is transferred to the destination.
- phases.
trialboolean If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
- phases.
trial_ endtimestamp | string Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with
trial
- proration_
behaviorenum If the update changes the billing configuration (item price, quantity, etc.) of the current phase, indicates how prorations from this change should be handled. The default value is
create_
.prorations Possible enum valuesalways_
invoice Prorate changes, and force an invoice to be immediately created for any prorations.
create_
prorations Prorate changes, but leave any prorations as pending invoice items to be picked up on the customer’s next invoice.
none
Does not create any prorations.
More parameters
- default_
settingshash Object representing the subscription schedule’s default settings.
- default_settings.
application_ fee_ percentfloatConnect only 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.
- default_settings.
automatic_ taxhash Default settings for automatic tax computation.
- default_settings.
automatic_tax. enabledbooleanRequired Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
- default_settings.
automatic_tax. liabilityhashConnect only 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.
- default_settings.
automatic_tax. liability. typeenumRequired Type of the account referenced in the request.
Possible enum valuesaccount
Indicates that the account being referenced is a connected account which is different from the account making the API request but related to it.
self
Indicates that the account being referenced is the account making the API request.
- default_settings.
automatic_tax. liability. accountstringRequired only if type is account The connected account being referenced when
type
isaccount
.
- default_settings.
billing_ cycle_ anchorenum Can be set to
phase_
to set the anchor to the start of the phase orstart automatic
to automatically change it if needed. Cannot be set tophase_
if this phase specifies a trial. For more information, see the billing cycle documentation.start Possible enum valuesautomatic
phase_
start - default_settings.
billing_ thresholdshash Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
- default_settings.
billing_thresholds. amount_ gteinteger Monetary threshold that triggers the subscription to advance to a new billing period
- default_settings.
billing_thresholds. reset_ billing_ cycle_ anchorboolean Indicates if the
billing_
should be reset when a threshold is reached. If true,cycle_ anchor billing_
will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.cycle_ anchor
- default_settings.
collection_ methodenum Either
charge_
, orautomatically send_
. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing 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 asinvoice active
. Defaults tocharge_
on creation.automatically Possible enum valuescharge_
automatically send_
invoice - default_settings.
default_ payment_ methodstring ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer’s invoice settings.
- default_settings.
descriptionstring Subscription 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.
- default_settings.
invoice_ settingshash All invoices will be billed using the specified settings.
- default_settings.
invoice_settings. account_ tax_ idsarray of strings The account tax IDs associated with the subscription schedule. Will be set on invoices generated by the subscription schedule.
- default_settings.
invoice_settings. days_ until_ dueinteger Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be
null
for subscription schedules wherecollection_
.method=charge_ automatically - default_settings.
invoice_settings. issuerhashConnect only The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
- default_settings.
invoice_settings. issuer. typeenumRequired Type of the account referenced in the request.
Possible enum valuesaccount
Indicates that the account being referenced is a connected account which is different from the account making the API request but related to it.
self
Indicates that the account being referenced is the account making the API request.
- default_settings.
invoice_settings. issuer. accountstringRequired only if type is account The connected account being referenced when
type
isaccount
.
- default_settings.
on_ behalf_ ofstringConnect only The account on behalf of which to charge, for each of the associated subscription’s invoices.
- default_settings.
transfer_ datahashConnect only The data with which to automatically create a Transfer for each of the associated subscription’s invoices.
- default_settings.
transfer_data. destinationstringRequired ID of an existing, connected Stripe account.
- default_settings.
transfer_data. amount_ percentfloat 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 destination account. By default, the entire amount is transferred to the destination.
- end_
behaviorenum Behavior of the subscription schedule and underlying subscription when it ends. Possible values are
release
orcancel
with the default beingrelease
.release
will end the subscription schedule and keep the underlying subscription running.cancel
will end the subscription schedule and cancel the underlying subscription.Possible enum valuescancel
Cancel the underlying subscription when the subscription schedule ends.
release
Persist the underlying subscription in its current state when the subscription schedule ends.
Returns
Returns an updated subscription schedule object if the call succeeded.
{ "id": "sub_sched_1Mr3YdLkdIwHu7ixjop3qtff", "object": "subscription_schedule", "application": null, "canceled_at": null, "completed_at": null, "created": 1680113835, "current_phase": null, "customer": "cus_NcI8FsMbh0OeFs", "default_settings": { "application_fee_percent": null, "automatic_tax": { "enabled": false, "liability": null }, "billing_cycle_anchor": "automatic", "collection_method": "charge_automatically", "default_payment_method": null, "default_source": null, "description": null, "invoice_settings": { "issuer": { "type": "self" } }, "on_behalf_of": null, "transfer_data": null }, "end_behavior": "release", "livemode": false, "metadata": {}, "phases": [ { "add_invoice_items": [], "application_fee_percent": null, "billing_cycle_anchor": null, "collection_method": null, "currency": "usd", "default_payment_method": null, "default_tax_rates": [], "description": null, "end_date": 1712339228, "invoice_settings": null, "items": [ { "metadata": {}, "plan": "price_1Mr3YcLkdIwHu7ixYCFhXHNb", "price": "price_1Mr3YcLkdIwHu7ixYCFhXHNb", "quantity": 1, "tax_rates": [] } ], "metadata": {}, "on_behalf_of": null, "proration_behavior": "create_prorations", "start_date": 1680716828, "transfer_data": null, "trial_end": null } ], "released_at": null, "released_subscription": null, "renewal_interval": null, "status": "not_started", "subscription": null, "test_clock": null}