Updates a subscription by modifying its item prices, coupons, billing configuration, payment method, and other attributes. Any parameters not provided remain unchanged. The changes can be applied immediately, scheduled for a future date, or even backdated to a past date.
Impacts
Subscription and Ramps: Impact on existing scheduled changes
- If the subscription has existing scheduled changes, the behavior depends on whether Ramps are enabled:
- Ramps disabled: Any existing scheduled change on the subscription is deleted.
- Ramps enabled with compatibility mode:
- If only one ramp is present:
- If the ramp was created using this API, the ramp is deleted.
- If the ramp was created using the Create a ramp API, and the date-time of the new change is before the date-time of the ramp, then the ramp is moved to
draftstatus if the auto-draft conditions are met.
- If multiple ramps are present: all ramps after the date-time of the new change are moved to
draftstatus if the auto-draft conditions are met.
- If only one ramp is present:
- For more details, see Ramps API compatibility mode.
Subscription: Other impacts
- When the Remove mandatory add-ons from old plan during subscription plan update setting is enabled on your Chargebee site, all mandatory addons with the old plan are automatically removed during the subscription update to a new plan.
Invoice
- If an invoice is generated, any available credits and excess payments for the customer are automatically applied subject to limits set at the site level, which can be overridden for subscriptions via
subscription.billing_override.
Credit Note
- When the subscription change occurs in the middle of a billing term, and
prorateistrue, prorated credits may be created for the unused service periods of the subscription items.
Payment Source
- If
payment_intent,payment_method, orcardparameters are provided, a new payment source is created for the customer and associated with the subscription as thepayment_source_id.
Use Cases
To add new item prices to the subscription, pass them in the subscription_items parameter.
Example
Consider a subscription with the following item prices:
plan-a-monthly-usdaddon-b-monthly-usd
If you call this API with the following item price:
addon-c-monthly-usd
The subscription will be updated to include the following item prices:
plan-a-monthly-usdaddon-b-monthly-usdaddon-c-monthly-usd
To replace all existing item prices in the subscription with a new set of item prices, include the replace_items_list parameter and set it to true.
Example
Consider a subscription with the following item prices:
plan-a-monthly-usdaddon-b-monthly-usd
If you call this API with the following item prices and set replace_items_list to true:
plan-c-monthly-usdaddon-d-monthly-usd
The subscription will be updated to include only the new item prices:
plan-c-monthly-usdaddon-d-monthly-usd
Use the payment_intent parameter to create a payment source for the customer. Using payment intents is the recommended way to create a payment source in Chargebee for both Strong Customer Authentication (SCA) (i.e. 3D-Secure) and non-SCA flows.
- Create a
payment_intentresource by calling the Create a payment intent API. - Pass the
payment_intentobject to your frontend and use Chargebee.js to capture the payment source details from the customer. Use Payment Method Helpers to show payment method UIs and collect payment method details from the customer. - Listen to the
payment_intent_updatedevent. Once thepayment_intent.statusisauthorized, pass thepayment_intent.idusing thepayment_intent[id]parameter in this API call.
If you prefer to use the payment gateway's SDKs to capture the payment method details, you can then use the payment_method parameter in this API to pass the payment method token and other details.
- Use the JavaScript library of your payment gateway to capture the payment method details. Examples include:
- Stripe.js
- Braintree.js
- Accept.js (if you use Authorize.Net)
- Adyen's Client-Side Encryption (if you use Adyen)
- Pass the payment method token using the
payment_method[reference_id]orpayment_method[tmp_token]parameter along with any additional parameters required by the payment gateway to create the payment source.
Sample Request
URL Format
Input Parameters
A list of item IDs representing the mandatorily attached addons associated with the plan to which the subscription is being updated. These addons will be removed from the subscription during the subscription update process.
Determines whether the provided subscription_items replace existing subscription items or are added to the existing list.
When subscription_items includes a plan
true: The entire subscription item list (plan and addons) is replaced by the provided list.false: The provided items are added to the existing list. If multi-plan subscriptions is disabled, the existing plan item price is replaced. If multi-plan subscriptions is enabled, the existing plan item price is retained.
When subscription_items contains only addons
- The existing plan on the subscription is always retained; it is not replaced.
true: Existing addons are replaced by the provided addons, except mandatory addons (auto-attached to the plan). Mandatory addons are kept unless you list them inmandatory_items_to_remove. The subscription will have the current plan, the addons you passed, plus any existing mandatory addons not inmandatory_items_to_remove.false: The provided addons are added to the existing addons.
Updates Net D for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid.
Constraints
- The value must match one of the options defined in your site configuration.
- To reset this attribute, set the value to
-1. When reset, it is not returned by the API, and thenet_term_daysvalue set at the customer level is used instead.
The document date displayed on the invoice PDF. Use this parameter to backdate the invoice for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date.
Prerequisites
invoice_immediatelymust betrue.
Default value
- The current date is used when not provided.
Constraints
- Must be a date-timein the past.
- Must not be more than one calendar month into the past. For example, if today is 13th January, you cannot pass a value that is earlier than 13th December.
- It must not be earlier than
changes_scheduled_at,reactivate_from, ortrial_end.
Impacts
taxes[]andline_item_taxes[]are computed based on the tax configuration as ofinvoice_date.- If
create_pending_invoicesis set totrue, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date.
The new start date of a future subscription.
Prerequisites
- The subscription
statusmust befuture.
The time at which the trial has ended or will end for the subscription. Set to 0 to have no trial period.
Constraints
- This is only allowed when the subscription
statusisfuture,in_trial, orcancelled. - The value must not be earlier than
changes_scheduled_atorstart_date. - This parameter can be backdated (set to a value in the past) only when the subscription is in
cancelledorin_trialstatus. Do this to keep a record of when the trial ended.
Impact
- When
trial_endis backdated, the subscription immediately goes intoactiveornon_renewingstatus.
The number of billing cycles the subscription runs before canceling automatically.
Default value
- The value set for the plan-item price is used when not provided.
The number of subscription billing cycles to invoice in advance.
If a new term is started for the subscription due to this API call, then terms_to_charge
is inclusive of this new term. See description for the force_term_reset
parameter to learn more about when a subscription term is reset.
If the subscription status
is cancelled
and it is being reactivated via this operation, this is the date/time at which the subscription should be reactivated.
Note:
It is recommended not to pass this parameter along with changed_scheduled_at.
reactivate_from
can be backdated (set to a value in the past). Use backdating when the subscription has been reactivated already but its billing has been delayed. Backdating is allowed only when the following prerequisites are met:
- Backdating must be enabled for subscription reactivation operations.
- The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is the day of the month by which the accounting for the previous month must be closed.
- The date is on or after the last date/time any of the product catalog items of the subscription were changed.
- The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April,
changes_scheduled_atcannot be earlier than 14th February.
Override the billing alignment mode chosen for the site for calendar billing. Only applicable when using calendar billing.
Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.
Subscription period will be aligned with the configured billing date at the next renewal.
Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property.
Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available.
Automatic collection of charges will not be made for this subscription. Use this for offline payments.
The preferred offline payment method for the subscription.
No Preference
Cash
Check
Bank Transfer
ACH Credit
The list of coupons to be applied to this subscription. You can provide coupon IDs or coupon codes.
Note
- If
changes_scheduled_atis in the past, you can use currently available coupons even if those coupons were not available on the date of the change.
Determines whether the provided coupon_ids replace or add to the existing coupons on the subscription.
Default value
false(the provided coupons are added to the existing coupons)
When this subscription change is set to occur in the middle of the subscription term, prorate determines whether prorated credits and charges are created for the change.
- When
true: Prorated credits or charges are created as applicable for this change. - When
false: The subscription is changed without creating any credits or charges.
Default value
The value configured in the site settings is used when not provided.Constraints
If you setprorate to true for a change made mid-term in the billing cycle, credits are not created if all of the following were true for a previous change in the same billing term:- The earlier change had
prorateset tofalse. - No changes were made to the subscription's billing term.
- Only the subscription's items or their prices were updated.
Deprecated
- This option is deprecated; use the Create a ramp API instead.
- If you pass this parameter along with
change_option, thenchange_optiontakes precedence.
This parameter has the same effect as setting the change_option parameter to end_of_term.
Forces the subscription term to start from the date of the subscription change when updating to a plan-item price with the same billing period as the current plan-item price.
Default value
false
Constraints
- Only applicable when the new plan-item price has the same billing period as the current plan-item price. When the billing period differs, the term is always reset regardless of this parameter's value.
- Only takes effect when
end_of_termisfalse. - If you pass
force_term_reset, you must also passinvoice_usageswith the same value when all of the following site configuration settings are enabled:- Usage-based billing
- Mid-term changes for usage-based items
- Invoice and charge for usage-based items when a subscription is changing
Determines whether to reactivate a cancelled subscription when making this API request.
Default value
truewhensubscription_itemsorcouponsare provided, unless explicitly set tofalse.
Required if
- The subscription
statusiscancelledand you want to reactivate it.
The Chargebee payment token generated by Chargebee JS.
Note:
The payment token created via Chargebee JS uses the gateway selected through Smart Routing.
Explicitly passing a gateway_id
in this API call will not override the gateway associated with the token.
A customer-facing note added to all invoices associated with this subscription. This note is one among all the notes displayed on the invoice PDF.
A collection of key-value pairs that provides extra information about the subscription.
Constraints
- There's a character limit of 65,535.
Determines whether charges raised immediately for the subscription are invoiced immediately or added to unbilled charges.
Default value
- The value configured in the site settings is used when not provided.
Note:
- Any charges scheduled to be raised in the future are not affected by this parameter.
If true
, ignores the hierarchy relationship
and uses customer as payment and invoice owner.
The date-time at which the subscription change is to happen or has happened.
Deprecated for scheduling changes
- Setting this parameter to a future date-time for scheduling changes is deprecated. Use the Create a ramp API instead.
Required if
change_optionis set tospecific_date.
Constraints
- Do not pass this parameter along with
reactivate_from.
Backdated changes
changes_scheduled_at can be set to a value in the past. This is called backdating the subscription change and is performed when the subscription change has already been provisioned but its billing has been delayed. Backdating is allowed only when the following prerequisites are met:- Backdating must be enabled for subscription change operations.
- Only the following changes can be backdated:
- Changes in the recurring items or their prices.
- Addition of non-recurring items.
- Subscription
statusisactive,cancelled, ornon_renewing. - The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is typically the day of the month by which the accounting for the previous month must be closed.
- The date is on or after
current_term_start. - The date is on or after the last date/time any of the following changes were made:
- Changes in the recurring items or their prices.
- Addition of non-recurring items.
Specifies when the subscription change takes effect.
Constraints
Regardless of the value of thechange_option parameter, the following parameters always take effect immediately:auto_collectionshipping_addresspo_number- Any subscription-level custom field parameters
See also
The subscription change takes effect immediately.
Deprecated
This option is deprecated; use the Create a ramp API instead.
The change is carried out at the end of the current billing cycle of the subscription.
Deprecated for scheduling changes
This option is deprecated for scheduling changes to occur at a future date-time, use the Create a ramp API instead.
Executes the change on a specified date. The change occurs as of the date-time defined in changes_scheduled_at.
Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as billing_cycles
or a custom value depending on the site configuration
.
The period of time by which the first billing term after trial is extended free of charge. The value is expressed in the time unit specified by free_period_unit. For example, 3 with free_period_unit = month adds 3 free months to the first paid term when the subscription becomes active.
The time unit for free_period.
Constraints
Must be equal to or lower than theperiod_unit of the plan item price of the subscription.Charge based on day(s)
Charge based on week(s)
Charge based on month(s)
Charge based on year(s)
Determines whether invoices for this subscription are generated with a pending status.
Prerequisites
- Metered Billing must be enabled for the site.
Default behavior
- Set to
trueautomatically when the subscription has item prices that belong tometereditems.
Use case
- Pending invoices allow you to inspect all charges on each invoice before closing it.
Overrides the site-level setting for auto-closing invoices for this subscription.
Prerequisites
- Auto-closing invoices must be enabled for the site.
Constraints
- This attribute has a higher precedence than the same attribute at the customer level.
Applicable only when End-of-trial Action has been enabled for the site. Whenever the subscription has a trial period, this attribute (parameter) is returned (required) and specifies the operation to be carried out for the subscription once the trial ends.
This is the default value. The action configured for the site at the time when the trial ends, takes effect.
The action configured for the site at the time when the trial ends, takes effect.
The subscription activates and charges are raised for non-metered items.
The subscription cancels.
The type of initiator to be used for the payment request triggered by this operation.
Pass this value to indicate that the request is initiated by the customer
Pass this value to indicate that the request is initiated by the merchant
Determines whether to invoice the overages for metered items during the subscription change.
Prerequisites
- Usage-based billing must be enabled.
Constraints
- If you pass
invoice_usages, you must also passforce_term_resetwith the same value when all of the following site configuration settings are enabled:- Mid-term changes for usage-based items
- Invoice and charge for usage-based items when a subscription is changing
statement_descriptor[<param name>]subscription_items[<param name>][<idx:0..n>]discounts[<param name>][<idx:0..n>]