Sample - Stripe API
POST/v1/subscriptions/{subscription_exposed_id}

Update a subscription

Updates an existing subscription's billing and collection settings, prices, quantities, discounts, or other configurable properties. Supply only the fields you want to change, and use proration_behavior to control how subscription changes affect invoicing when applicable. Use the invoice preview flow to review proration calculations before applying changes.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.
  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 32 body fields
subscription_exposed_idstringrequired
The subscription identifier to update. Maximum 5,000 characters.

Optional form-encoded subscription update. Supply only the properties that you want to change.

add_invoice_itemsarray<AddInvoiceItemEntry>optional
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.
application_fee_percentnumberoptional
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](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
automatic_taxobjectoptional
Automatic tax settings for this subscription. We recommend you only include this parameter when the existing value is being changed.
billing_cycle_anchorstringoptional
Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). For more information, see the billing cycle [documentation](https://docs.stripe.com/billing/subscriptions/billing-cycle).
Allowed:nowunchanged
billing_schedulesarray<BillingSchedulesUpdateParams>optional
An array of billing schedules, which allow you to bill customers in advance for multiple service periods. Requires flexible billing mode and API version 2026-05-27.dahlia or later. Learn more about [prebilling](https://docs.stripe.com/billing/subscriptions/prebilling).
billing_thresholdsobjectoptional
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_atintegeroptional
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_endbooleanoptional
Indicate whether this subscription should cancel at the end of the current period (`current_period_end`).
cancellation_detailsobjectoptional
Details about why this subscription was cancelled
collection_methodstringoptional
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`.
Allowed:charge_automaticallysend_invoice
days_until_dueintegeroptional
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_methodstringoptional
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](https://docs.stripe.com/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://docs.stripe.com/api/customers/object#customer_object-default_source).
default_sourcestringoptional
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](https://docs.stripe.com/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://docs.stripe.com/api/customers/object#customer_object-default_source).
default_tax_ratesarray<string>optional
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. Pass an empty string to remove previously-defined tax rates.
descriptionstringoptional
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.
discountsarray<DiscountsDataParam>optional
The coupons to redeem into discounts for the subscription. A populated array overwrites the existing discounts on the subscription. If not specified or empty array, it leaves the subscription's discounts unchanged. If empty string, it clears the subscription's discounts.
expandarray<string>optional
Specifies which fields in the response should be expanded.
invoice_settingsobjectoptional
All invoices will be billed using the specified settings.
itemsarray<SubscriptionItemUpdateParams>optional
A list of up to 20 subscription items, each with an attached price.
metadataobjectoptional
Set of [key-value pairs](https://docs.stripe.com/api/metadata) 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_sessionbooleanoptional
Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to `false` (on-session).
on_behalf_ofstringoptional
The account on behalf of which to charge, for each of the subscription's invoices.
pause_collectionobjectoptional
If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://docs.stripe.com/billing/subscriptions/pause-payment).
payment_behaviorstringoptional
Controls how Stripe handles payment when a subscription update requires payment and `collection_method=charge_automatically`.
Allowed:allow_incompletedefault_incompleteerror_if_incompletepending_if_incomplete
payment_settingsobjectoptional
Payment settings to pass to invoices created by the subscription.
pending_invoice_item_intervalobjectoptional
Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](/api/invoices/create) for the given subscription at the specified interval.
proration_behaviorstringoptional
Determines how to handle [prorations](https://docs.stripe.com/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting `billing_cycle_anchor=now`, or starting a trial), or if an item's `quantity` changes. The default value is `create_prorations`.
Allowed:always_invoicecreate_prorationsnone
proration_dateintegeroptional
If set, prorations will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same prorations that were previewed with the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint. `proration_date` can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations.
transfer_dataobjectoptional
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. This will be unset if you POST an empty value.
trial_endstringoptional
Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, `trial_end` will override the default trial period of the plan the customer is being subscribed to. The `billing_cycle_anchor` will be updated to the `trial_end` value. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`.
Allowed:now
trial_from_planbooleanoptional
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](https://docs.stripe.com/billing/subscriptions/trials) to learn more.
trial_settingsobjectoptional
Settings related to subscription trials.

2 status codes
200Returns the updated subscription object with its billing mode, collection settings, items, customer, invoice settings, and current status.
applicationstringoptional
ID of the Connect Application that created the subscription.
application_fee_percentnumberoptional
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_taxobjectrequired
billing_cycle_anchorintegerrequired
The reference point that aligns future [billing cycle](https://docs.stripe.com/subscriptions/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_configobjectoptional
The fixed values used to calculate the `billing_cycle_anchor`.
billing_modeobjectrequired
The billing mode of the subscription.
billing_schedulesarray<SubscriptionsResourceBillingSchedules>required
Billing schedules for this subscription.
billing_thresholdsobjectoptional
Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
cancel_atintegeroptional
A date in the future at which the subscription will automatically get canceled
cancel_at_period_endbooleanrequired
Whether this subscription will (if `status=active`) or did (if `status=canceled`) cancel at the end of the current billing period.
canceled_atintegeroptional
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_detailsobjectoptional
Details about why this subscription was cancelled
collection_methodstringrequired
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`.
Allowed:charge_automaticallysend_invoice
createdintegerrequired
Time at which the object was created. Measured in seconds since the Unix epoch.
currencystringrequired
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
customerstringrequired
ID of the customer who owns the subscription.
customer_accountstringoptional
ID of the account representing the customer who owns the subscription.
days_until_dueintegeroptional
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_methodstringoptional
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](https://docs.stripe.com/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://docs.stripe.com/api/customers/object#customer_object-default_source).
default_sourcestringoptional
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](https://docs.stripe.com/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://docs.stripe.com/api/customers/object#customer_object-default_source).
default_tax_ratesarray<TaxRate>optional
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.
descriptionstringoptional
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.
discountsarray<string>required
The discounts applied to the subscription. Subscription item discounts are applied before subscription discounts. Use `expand[]=discounts` to expand each discount.
ended_atintegeroptional
If the subscription has ended, the date the subscription ended.
idstringrequired
Unique identifier for the object.
invoice_settingsobjectrequired
itemsobjectrequired
List of subscription items, each with an attached price.
latest_invoicestringoptional
The most recent invoice this subscription has generated over its lifecycle (for example, when it cycles or is updated).
livemodebooleanrequired
If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
managed_paymentsobjectoptional
Settings for Managed Payments for this Subscription and resulting [Invoices](/api/invoices/object) and [PaymentIntents](/api/payment_intents/object).
metadataobjectrequired
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
next_pending_invoice_item_invoiceintegeroptional
Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at `pending_invoice_item_interval`.
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
Allowed:subscription
on_behalf_ofstringoptional
The account (if any) the charge was made on behalf of for charges associated with this subscription. See the [Connect documentation](https://docs.stripe.com/connect/subscriptions#on-behalf-of) for details.
pause_collectionobjectoptional
If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://docs.stripe.com/billing/subscriptions/pause-payment).
payment_settingsobjectoptional
Payment settings passed on to invoices created by the subscription.
pending_invoice_item_intervalobjectoptional
Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](/api/invoices/create) for the given subscription at the specified interval.
pending_setup_intentstringoptional
You can use this [SetupIntent](https://docs.stripe.com/api/setup_intents) to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the [SCA Migration Guide](https://docs.stripe.com/billing/migration/strong-customer-authentication#scenario-2).
pending_updateobjectoptional
If specified, [pending updates](https://docs.stripe.com/billing/subscriptions/pending-updates) that will be applied to the subscription once the `latest_invoice` has been paid.
presentment_detailsobjectoptional
schedulestringoptional
The schedule attached to the subscription
start_dateintegerrequired
Date when the subscription was first created. The date might differ from the `created` date due to backdating.
statusstringrequired
Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, `unpaid`, or `paused`. For `collection_method=charge_automatically` a subscription moves into `incomplete` if the initial payment attempt fails. A subscription in this status can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an `active` status. If the first invoice is not paid within 23 hours, the subscription transitions to `incomplete_expired`. This is a terminal status, the open invoice will be voided and no further invoices will be generated. A subscription that is currently in a trial period is `trialing` and moves to `active` when the trial period is over. A subscription can only enter a `paused` status [when a trial ends without a payment method](https://docs.stripe.com/billing/subscriptions/trials#create-free-trials-without-payment). A `paused` subscription doesn't generate invoices and can be resumed after your customer adds their payment method. The `paused` status is different from [pausing collection](https://docs.stripe.com/billing/subscriptions/pause-payment), which still generates invoices and leaves the subscription's status unchanged. If subscription `collection_method=charge_automatically`, it becomes `past_due` when payment is required but cannot be paid (due to failed payment or awaiting additional user actions). Once Stripe has exhausted all payment retry attempts, the subscription will become `canceled` or `unpaid` (depending on your subscriptions settings). If subscription `collection_method=send_invoice` it becomes `past_due` when its invoice is not paid by the due date, and `canceled` or `unpaid` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of `unpaid`, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.
Allowed:activecanceledincompleteincomplete_expiredpast_duepausedtrialingunpaid
test_clockstringoptional
ID of the test clock this subscription belongs to.
transfer_dataobjectoptional
The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
trial_endintegeroptional
If the subscription has a trial, the end of that trial.
trial_settingsobjectoptional
Settings related to subscription trials.
trial_startintegeroptional
If the subscription has a trial, the beginning of that trial.
defaultError response.
errorobjectrequired

Error handling

subscription_exposed_id must identify the subscription and must not exceed 5,000 characters. billing_mode.type is required when billing_mode is supplied and must be flexible; constrained values such as billing_cycle_anchor, collection_method, and proration_behavior must match their listed enums. description must not exceed 500 characters, and application_fee_percent must be between 0 and 100 with at most two decimal places.