Skip to content

Stripe: Update a subscription on a customer

Stripe customers.postCustomersCustomerSubscriptionsSubscriptionExposedId: arguments, response, policy and SDK examples.

← Customers operations · Get started

Operation stripe.postcustomerscustomersubscriptionssubscriptionexposedid

Provider route: POST /v1/customers/{customer}/subscriptions/{subscription_exposed_id}. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/stripe with npm, or alter-sdk-stripe with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { StripeIntegration } from "@alter-ai/stripe";
async function execute(input: Parameters<StripeIntegration["customers"]["postCustomersCustomerSubscriptionsSubscriptionExposedId"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new StripeIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.customers.postCustomersCustomerSubscriptionsSubscriptionExposedId(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_stripe import StripeIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = StripeIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.customers.post_customers_customer_subscriptions_subscription_exposed_id(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.customerstringRequired within parentMaximum length: 5000
path.subscription_exposed_idstringRequired within parentMaximum length: 5000
headersobjectOptionalAdditional keys: not allowed
headers.Idempotency-KeystringOptionalMinimum length: 1
Maximum length: 255
bodyobjectOptionalAdditional keys: not allowed
body.add_invoice_itemsarrayOptionalA 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.
body.add_invoice_items[]ModelEach itemExpand Update a subscription — request body — body add invoice items item
body.application_fee_percentJSONOptionalA 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).
body.application_fee_percent (anyOf 1)numberAlternative
body.application_fee_percent (anyOf 2)stringAlternativeOne of:
body.automatic_taxobjectOptionalAutomatic tax settings for this subscription. We recommend you only include this parameter when the existing value is being changed.
body.automatic_tax.enabledbooleanRequired within parent
body.automatic_tax.liabilityobjectOptional
body.automatic_tax.liability.accountstringOptional
body.automatic_tax.liability.typestringRequired within parentOne of: account, self
body.billing_cycle_anchorstringOptionalEither `now` or `unchanged`. Setting the value to `now` resets the subscription’s billing cycle anchor to the current time. For more information, see the billing cycle [documentation](https://docs.stripe.com/billing/subscriptions/billing-cycle).
One of: now, unchanged
Maximum length: 5000
body.billing_thresholdsJSONOptionalDefine 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.
body.billing_thresholds (anyOf 1)objectAlternative
body.billing_thresholds (anyOf 1).amount_gteintegerOptional
body.billing_thresholds (anyOf 1).reset_billing_cycle_anchorbooleanOptional
body.billing_thresholds (anyOf 2)stringAlternativeOne of:
body.cancel_atJSONOptionalA 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.
body.cancel_at (anyOf 1)integerAlternativeFormat: unix-time
body.cancel_at (anyOf 2)stringAlternativeOne of:
body.cancel_at (anyOf 3)stringAlternativeOne of: max_billed_until, max_period_end, min_period_end
body.cancel_at_period_endbooleanOptionalIndicate whether this subscription should cancel at the end of the current period (`current_period_end`).
body.cancellation_detailsobjectOptionalDetails about why this subscription was cancelled
body.cancellation_details.commentJSONOptional
body.cancellation_details.comment (anyOf 1)stringAlternativeMaximum length: 5000
body.cancellation_details.comment (anyOf 2)stringAlternativeOne of:
body.cancellation_details.feedbackstringOptionalOne of: , customer_service, low_quality, missing_features, other, switched_service, too_complex, too_expensive, unused
body.cancellation_details.feedback_optionstringOptionalMaximum length: 5000
body.collection_methodstringOptionalEither `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`.
One of: charge_automatically, send_invoice
body.days_until_dueintegerOptionalNumber of days a customer has to pay invoices generated by this subscription. Valid only for subscriptions where `collection_method` is set to `send_invoice`.
body.default_payment_methodstringOptionalID 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).
Maximum length: 5000
body.default_sourceJSONOptionalID 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).
body.default_source (anyOf 1)stringAlternativeMaximum length: 5000
body.default_source (anyOf 2)stringAlternativeOne of:
body.default_tax_ratesJSONOptionalThe 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.
body.default_tax_rates (anyOf 1)arrayAlternative
body.default_tax_rates (anyOf 1)[]stringEach itemMaximum length: 5000
body.default_tax_rates (anyOf 2)stringAlternativeOne of:
body.discountsJSONOptionalThe 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.
body.discounts (anyOf 1)arrayAlternative
body.discounts (anyOf 1)[]objectEach item
body.discounts (anyOf 1)[].couponstringOptionalMaximum length: 5000
body.discounts (anyOf 1)[].discountstringOptionalMaximum length: 5000
body.discounts (anyOf 1)[].promotion_codestringOptionalMaximum length: 5000
body.discounts (anyOf 2)stringAlternativeOne of:
body.expandarrayOptionalSpecifies which fields in the response should be expanded.
body.expand[]stringEach itemMaximum length: 5000
body.invoice_settingsModelOptionalExpand Update a subscription — request body — body invoice settings
body.itemsarrayOptionalA list of up to 20 subscription items, each with an attached price.
body.items[]ModelEach itemExpand Update a subscription — request body — body items item
body.metadataJSONOptionalSet 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`.
body.metadata (anyOf 1)objectAlternativeAdditional keys: see wildcard field
body.metadata (anyOf 1).*stringAdditional keys
body.metadata (anyOf 2)stringAlternativeOne of:
body.off_sessionbooleanOptionalIndicates if a customer is on or off-session while an invoice payment is attempted. Defaults to `false` (on-session).
body.pause_collectionJSONOptionalIf 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).
body.pause_collection (anyOf 1)objectAlternative
body.pause_collection (anyOf 1).behaviorstringRequired within parentOne of: keep_as_draft, mark_uncollectible, void
body.pause_collection (anyOf 1).resumes_atintegerOptionalFormat: unix-time
body.pause_collection (anyOf 2)stringAlternativeOne of:
body.payment_behaviorstringOptionalControls how Stripe handles payment when a subscription update requires payment and `collection_method=charge_automatically`.
One of: allow_incomplete, default_incomplete, error_if_incomplete, pending_if_incomplete
body.payment_settingsModelOptionalExpand Update a subscription — request body — body payment settings
body.pending_invoice_item_intervalJSONOptionalSpecifies 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.
body.pending_invoice_item_interval (anyOf 1)objectAlternative
body.pending_invoice_item_interval (anyOf 1).intervalstringRequired within parentOne of: day, month, week, year
body.pending_invoice_item_interval (anyOf 1).interval_countintegerOptional
body.pending_invoice_item_interval (anyOf 2)stringAlternativeOne of:
body.proration_behaviorstringOptionalDetermines 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`.
One of: always_invoice, create_prorations, none
body.proration_dateintegerOptionalIf 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.
Format: unix-time
body.transfer_dataJSONOptionalIf 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.
body.transfer_data (anyOf 1)objectAlternative
body.transfer_data (anyOf 1).amount_percentnumberOptional
body.transfer_data (anyOf 1).destinationstringRequired within parent
body.transfer_data (anyOf 2)stringAlternativeOne of:
body.trial_endJSONOptionalUnix 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 special value `now` can be provided to end the customer’s trial immediately. Can be at most two years from `billing_cycle_anchor`.
body.trial_end (anyOf 1)stringAlternativeOne of: now
Maximum length: 5000
body.trial_end (anyOf 2)integerAlternativeFormat: unix-time
body.trial_from_planbooleanOptionalIndicates 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/free-trials) to learn more.
body.trial_settingsobjectOptionalSettings related to subscription trials.
body.trial_settings.end_behaviorobjectRequired within parent
body.trial_settings.end_behavior.billing_cycle_anchorstringOptionalOne of: now, unchanged
body.trial_settings.end_behavior.missing_payment_methodstringOptionalOne of: cancel, create_invoice, pause

Referenced models: Update a subscription — request body — body add invoice items item, Update a subscription — request body — body invoice settings, Update a subscription — request body — body items item, Update a subscription — request body — body payment settings

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Pause a subscription — response body

Referenced models: Pause a subscription — response body

712 more schemas are linked from the tables above, on the schema pages.

Update a subscription — request body — body add invoice items item
FieldTypePresenceDescription and constraints
$objectRoot
discountablebooleanOptional
discountsarrayOptional
discounts[]objectEach item
discounts[].couponstringOptionalMaximum length: 5000
discounts[].discountstringOptionalMaximum length: 5000
discounts[].promotion_codestringOptionalMaximum length: 5000
metadataobjectOptionalAdditional keys: see wildcard field
metadata.*stringAdditional keys
periodobjectOptional
period.endobjectRequired within parent
period.end.timestampintegerOptionalFormat: unix-time
period.end.typestringRequired within parentOne of: min_item_period_end, timestamp
period.startobjectRequired within parent
period.start.timestampintegerOptionalFormat: unix-time
period.start.typestringRequired within parentOne of: max_item_period_start, now, timestamp
pricestringOptionalMaximum length: 5000
price_dataobjectOptional
price_data.currencystringRequired within parentFormat: currency
price_data.productstringRequired within parentMaximum length: 5000
price_data.tax_behaviorstringOptionalOne of: exclusive, inclusive, unspecified
price_data.unit_amountintegerOptional
price_data.unit_amount_decimalstringOptionalFormat: decimal
quantityintegerOptional
tax_ratesJSONOptional
tax_rates (anyOf 1)arrayAlternative
tax_rates (anyOf 1)[]stringEach itemMaximum length: 5000
tax_rates (anyOf 2)stringAlternativeOne of:
Update a subscription — request body — body invoice settings
FieldTypePresenceDescription and constraints
$objectRootAll invoices will be billed using the specified settings.
account_tax_idsJSONOptional
account_tax_ids (anyOf 1)arrayAlternative
account_tax_ids (anyOf 1)[]stringEach itemMaximum length: 5000
account_tax_ids (anyOf 2)stringAlternativeOne of:
custom_fieldsJSONOptional
custom_fields (anyOf 1)arrayAlternative
custom_fields (anyOf 1)[]objectEach item
custom_fields (anyOf 1)[].namestringRequired within parentMaximum length: 40
custom_fields (anyOf 1)[].valuestringRequired within parentMaximum length: 140
custom_fields (anyOf 2)stringAlternativeOne of:
descriptionJSONOptional
description (anyOf 1)stringAlternativeMaximum length: 1500
description (anyOf 2)stringAlternativeOne of:
footerJSONOptional
footer (anyOf 1)stringAlternativeMaximum length: 5000
footer (anyOf 2)stringAlternativeOne of:
issuerobjectOptional
issuer.accountstringOptional
issuer.typestringRequired within parentOne of: account, self
Update a subscription — request body — body items item
FieldTypePresenceDescription and constraints
$objectRoot
billing_thresholdsJSONOptional
billing_thresholds (anyOf 1)objectAlternative
billing_thresholds (anyOf 1).usage_gteintegerRequired within parent
billing_thresholds (anyOf 2)stringAlternativeOne of:
clear_usagebooleanOptional
current_trialobjectOptional
current_trial.trial_offerstringRequired within parentMaximum length: 5000
deletedbooleanOptional
discountsJSONOptional
discounts (anyOf 1)arrayAlternative
discounts (anyOf 1)[]objectEach item
discounts (anyOf 1)[].couponstringOptionalMaximum length: 5000
discounts (anyOf 1)[].discountstringOptionalMaximum length: 5000
discounts (anyOf 1)[].promotion_codestringOptionalMaximum length: 5000
discounts (anyOf 2)stringAlternativeOne of:
idstringOptionalMaximum length: 5000
metadataJSONOptional
metadata (anyOf 1)objectAlternativeAdditional keys: see wildcard field
metadata (anyOf 1).*stringAdditional keys
metadata (anyOf 2)stringAlternativeOne of:
pricestringOptionalMaximum length: 5000
price_dataModelOptionalExpand Update a subscription — request body — body items item price data
quantityintegerOptional
tax_ratesJSONOptional
tax_rates (anyOf 1)arrayAlternative
tax_rates (anyOf 1)[]stringEach itemMaximum length: 5000
tax_rates (anyOf 2)stringAlternativeOne of:

Referenced models: Update a subscription — request body — body items item price data

Update a subscription — request body — body payment settings
FieldTypePresenceDescription and constraints
$objectRootPayment settings to pass to invoices created by the subscription.
payment_method_optionsModelOptionalExpand Update a subscription — request body — body payment settings payment method options
payment_method_typesJSONOptional
payment_method_types (anyOf 1)arrayAlternative
payment_method_types (anyOf 1)[]stringEach itemOne of: ach_credit_transfer, ach_debit, acss_debit, affirm, alipay, amazon_pay, au_becs_debit, bacs_debit, bancontact, billie, blik, boleto, card, cashapp, crypto, custom, customer_balance, eps, fpx, giropay, grabpay, ideal, jp_credit_transfer, kakao_pay, klarna, konbini, kr_card, link, mb_way, multibanco, naver_pay, nz_bank_account, p24, pay_by_bank, payco, paynow, paypal, payto, pix, promptpay, revolut_pay, satispay, sepa_credit_transfer, sepa_debit, sofort, swish, twint, upi, us_bank_account, wechat_pay
payment_method_types (anyOf 2)stringAlternativeOne of:
save_default_payment_methodstringOptionalOne of: off, on_subscription

Referenced models: Update a subscription — request body — body payment settings payment method options

PostApplicationFeesIdRefund — response body — application / object: application
FieldTypePresenceDescription and constraints
$objectRoot
idstringRequired within parentUnique identifier for the object.
Maximum length: 5000
nameJSONOptional
name (anyOf 1)stringAlternativeThe name of the application.
Maximum length: 5000
name (anyOf 2)nullAlternative
objectstringRequired within parentString representing the object's type. Objects of the same type share the same value.
Known values: application
Pause a subscription — response body — cancellation details Details about why this subscription was cancelled comment, feedback, feedback option, reason
FieldTypePresenceDescription and constraints
$objectRoot
commentJSONOptional
comment (anyOf 1)stringAlternativeAdditional comments about why the user canceled the subscription, if the subscription was canceled explicitly by the user.
Maximum length: 5000
comment (anyOf 2)nullAlternative
feedbackJSONOptional
feedback (anyOf 1)stringAlternativeThe customer submitted reason for why they canceled, if the subscription was canceled explicitly by the user.
Known values: customer_service, low_quality, missing_features, other, switched_service, too_complex, too_expensive, unused
feedback (anyOf 2)nullAlternative
feedback_optionJSONOptional
feedback_option (anyOf 1)JSONAlternativeCustomized feedback options that provide deeper insight into why the subscription was canceled, if the subscription was canceled explicitly by the user.
feedback_option (anyOf 1) (anyOf 1)stringAlternativeMaximum length: 5000
feedback_option (anyOf 1) (anyOf 2)ModelAlternativeExpand Create a feedback option — response body
feedback_option (anyOf 2)nullAlternative
reasonJSONOptional
reason (anyOf 1)stringAlternativeWhy this subscription was canceled.
Known values: canceled_by_retention_policy, cancellation_requested, payment_disputed, payment_failed
reason (anyOf 2)nullAlternative

Referenced models: Create a feedback option — response body

Delete a customer — response body
FieldTypePresenceDescription and constraints
$objectRoot
deletedbooleanRequired within parentAlways true for a deleted object
Known values: True
idstringRequired within parentUnique identifier for the object.
Maximum length: 5000
objectstringRequired within parentString representing the object's type. Objects of the same type share the same value.
Known values: customer

SDK function policy ID: stripe.postcustomerscustomersubscriptionssubscriptionexposedid. Catalog operation: PostCustomersCustomerSubscriptionsSubscriptionExposedId. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Pinned headers: {"Stripe-Version": "2026-09-30.endive"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.