Returns an estimate for updating a subscription.
In the response,
subscription_estimate: The details of the changed subscription such asstatus, next billing date, and so on.invoice_estimate:The details of the immediate invoice, if it is generated. An immediate invoice is not generated when:end_of_termparameter is trueprorateparameter isfalse- No changes are made to the plan item prices or addon item prices in
subscription_items. - For changes such as quantity downgrades.
next_invoice_estimate:The details of the invoice to be generated later (if any) on the occasion that no immediate invoice has been generated.credit_note_estimates:The list of credit notes (if any) generated during this operation.unbilled_charge_estimates: The details of charges that have not been invoiced. This is returned only if theinvoice_immediatelyparameter is set tofalse.
The following conditions must be met or tax calculation is ignored:
- The
taxabilityattribute for the customer istrue. - Necessary parameters for tax calculation such as the following are passed:
billing_address,shipping_address,customer[vat_number]
Sample Request
URL Format
Input Parameters
Caution This parameter is unavailable when the Subscription Ramps feature is enabled; use Create a ramp API instead.
When change_option
is set to specific_date
, then set the date/time at which the subscription change is to happen or has happened. Note:
It is recommended not to pass this parameter along with reactivate_from.
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.
-
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. .
Specifies the effective date for the subscription change.
The change is carried out immediately.
The change is carried out at the end of the current billing cycle of the subscription.
Executes the change on a specified date. The change occurs as of the date/time defined in changes_scheduled_at.
Caution
The end_of_term and specific_date options are unavailable when the Subscription Ramps feature is enabled; use Create a ramp API instead.
Item ids of mandatorily attached addons that are to be removed from the subscription.
If true
then the existing subscription_items
list for the subscription is replaced by the one provided. If false
then the provided subscription_items
list gets added to the existing list.
The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if create_pending_invoices
is set to true
, 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. taxes and line_item_taxes are computed based on the tax configuration as of invoice_date.
When passing this parameter, the following prerequisites must be met:
invoice_datemust be in the past.invoice_dateis not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December.- It is not earlier than
changes_scheduled_at,reactivate_from, ortrial_end. invoice_immediatelyistrue. .
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.
List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes .
If true
then the existing coupon_ids
list for the subscription is replaced by the one provided. If false
then the provided list gets added to the existing coupon_ids
.
- 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. - When not provided, the value configured in the site settings is considered.
Caveat
For further changes within the same billing term, when prorate is set to true, credits are not created when all the conditions below hold true:
An immediate previous change was made
- with
prorateset tofalseand - no changes were made to the subscription's billing term and
- a change was made to either the subscription's items or their prices.
Set this to true if you want the update to be applied at the end of the current subscription billing cycle.
Say the subscription has the renewal date as 28th of every month. When the plan-item price of the subscription is set to one that has the same billing period as the current plan-item price, the subscription change does not change the term. In other words, the subscription still renews on the 28th. Passing this parameter as true
will have the subscription reset its term to the current date (provided end_of_term
is false).
Note:
When the new plan-item price has a billing period different from the current plan-item price of the subscription, the term is always reset, regardless of the value passed for this parameter.
Applicable only for cancelled
subscriptions. When passed as true
, the canceled subscription is activated; otherwise subscription changes are made without changing its status.
If not passed, subscription will be activated only if subscription_items
is passed.
If true, all the unbilled charges will be included for the invoice estimate.
The generated invoice_estimate/next_invoice_estimate will include all the balances - Promotional Credits, Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter use_existing_balances .
If there are charges raised immediately for the subscription, this parameter specifies whether those charges are to be invoiced immediately or added to unbilled charges. The default value is as per the site settings .
Note:
invoice_immediately
only affects charges that are raised at the time of execution of this API call. Any charges scheduled to be raised in the future are not affected by this parameter.
.
Setting this attribute to true will invoice the overages for the metered item during subscription changes
.
Returns
Resource object representing estimate