During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges.
For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on.
If you have configured the Avalara integration, Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits.
{
"created_at": 1517505710,
"invoice_estimate": {
"amount_due": 895,
"amount_paid": 0,
"credits_applied": 0,
"currency_code": "USD",
"customer_id": "__test__KyVnHhSBWl2E82aS",
"date": 1517505710,
"line_item_discounts": [],
"line_item_taxes": [],
"line_items": [{
"amount": 895,
"customer_id": "__test__KyVnHhSBWl2E82aS",
"date_from": 1517505710,
"date_to": 1519924910,
"description": "No Trial",
"discount_amount": 0,
"entity_id": "no_trial",
"entity_type": "plan",
"id": "li___test__KyVnHhSBWl2Eq2aU",
"is_taxed": false,
"item_level_discount_amount": 0,
"object": "line_item",
"pricing_model": "per_unit",
"quantity": 1,
"tax_amount": 0,
"unit_amount": 895
}],
"object": "invoice_estimate",
"price_type": "tax_exclusive",
"recurring": true,
"round_off_amount": 0,
"sub_total": 895,
"taxes": [],
"total": 895
},
"object": "estimate",
"subscription_estimate": {
"currency_code": "USD",
"next_billing_at": 1519924910,
"object": "subscription_estimate",
"status": "active"
}
}
trial_end_action
is not defined for the plan.plan_defaultThe action configured for the site at the time when the trial ends, takes effect. This is the default value when trial_end_action
is defined for the plan.activate_subscriptionThe subscription activates and charges are raised for non-metered items.cancel_subscriptionThe subscription cancels.state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to renew
.contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to cancel
.active
contract terms, this is a predicted value. The value depends on the type of currency. If the subscription was imported with the contract term, then this value includes the value passed for total_amount_raised
.total_amount_raised_before_tax
is included in the calculation of the total contract value before tax. It's important to note that this value excludes any applicable taxes.contract_end
, during which the customer is barred from canceling the contract term. The customer is allowed to cancel the contract term via the Self-Serve Portal only before this period. This allows you to have sufficient time for processing the contract term closureround_off_amount
. If there is no round-off amount
, it will display 0
.Note
Line items that meet both the following conditions are not returned:
metered
.line_item.amount
is 0
.line_item
. The value is in major units of the currency. Returned when the line_item
is quantity-based and multi-decimal pricing is enabled.line_item
is quantity-based and multi-decimal pricing is enabled.line_item
, in major units of the currency. Typically equals to unit_amount_in_decimal
x quantity_in_decimal
. Returned when multi-decimal pricing is enabled.billing_address
and shipping_address
have not been provided for the customer and subscription respectivelycustomer_exemptIf the Customer is marked as Tax exemptdiscounts[entity_type]
is item_level_coupon
or document_level_coupon
.id
is passed as entity_id
.document_level_couponThe deduction is due to a coupon applied to the invoice sub_total
. The coupon id is passed as entity_id
.promotional_creditsThe deduction is due to a promotional credit applied to the invoice. prorated_creditsThe deduction is due to a legacy adjustment credit applied to the invoice. The entity_id
is null
in this case. The legacy credits feature is superseded by adjustment_credit_notes
.coupon
, then this is the id
of the coupon.entity_id
.stairtstep
pricing , or the price of each unit in the tier if the charge model is tiered
/volume
pricing.ending_unit_in_decimal
of the next lower tier. Returned only when the line_items.pricing_model
is tiered
, volume
or stairstep
and multi-decimal pricing is enabled.starting_unit_in_decimal
of the next higher tier. Returned only when the line_items.pricing_model
is tiered
, volume
or stairstep and multi-decimal pricing is enabled.line_item
is quantity-based and multi-decimal pricing is enabled.pricing_model
is tiered
or volume
. When the pricing_model
is stairstep
, it is the decimal representation of the total price for line_item
. The value is in major units of the currency. Returned when the line_item
is quantity-based and multi-decimal pricing is enabled.id
is available as entity_id
.document_level_couponThe deduction is due to a coupon applied to the invoice sub_total
. The coupon id
is available as entity_id
.promotional_creditsThe deduction is due to a promotional credit applied to the invoice. The entity_id
is null
in this case.prorated_creditsThe deduction is due to a legacy adjustment credit applied to the invoice. The entity_id
is null
in this case. The legacy credits feature is superseded by adjustment_credit_notes
.round_off_amount
. If there is no round-off amount
, it will display 0
.line_item
. The value is in major units of the currency. Returned when the line_item
is quantity-based and multi-decimal pricing is enabled.line_item
is quantity-based and multi-decimal pricing is enabled.line_item
, in major units of the currency. Typically equals to unit_amount_in_decimal
x quantity_in_decimal
. Returned when multi-decimal pricing is enabled.billing_address
and shipping_address
have not been provided for the customer and subscription respectivelycustomer_exemptIf the Customer is marked as Tax exemptdiscounts[entity_type]
is item_level_coupon
or document_level_coupon
.id
is passed as entity_id
.document_level_couponThe deduction is due to a coupon applied to the invoice sub_total
. The coupon id is passed as entity_id
.promotional_creditsThe deduction is due to a promotional credit applied to the invoice. prorated_creditsThe deduction is due to a legacy adjustment credit applied to the invoice. The entity_id
is null
in this case. The legacy credits feature is superseded by adjustment_credit_notes
.coupon
, then this is the id
of the coupon.entity_id
.id
is available as entity_id
.document_level_couponThe deduction is due to a coupon applied to the invoice sub_total
. The coupon id
is available as entity_id
.promotional_creditsThe deduction is due to a promotional credit applied to the invoice. The entity_id
is null
in this case.prorated_creditsThe deduction is due to a legacy adjustment credit applied to the invoice. The entity_id
is null
in this case. The legacy credits feature is superseded by adjustment_credit_notes
.stairtstep
pricing , or the price of each unit in the tier if the charge model is tiered
/volume
pricing.ending_unit_in_decimal
of the next lower tier. Returned only when the line_items.pricing_model
is tiered
, volume
or stairstep
and multi-decimal pricing is enabled.starting_unit_in_decimal
of the next higher tier. Returned only when the line_items.pricing_model
is tiered
, volume
or stairstep and multi-decimal pricing is enabled.line_item
is quantity-based and multi-decimal pricing is enabled.pricing_model
is tiered
or volume
. When the pricing_model
is stairstep
, it is the decimal representation of the total price for line_item
. The value is in major units of the currency. Returned when the line_item
is quantity-based and multi-decimal pricing is enabled.unit_amount_in_decimal
x quantity_in_decimal
. Returned when multi-decimal pricing is enabled.stairtstep
pricing , or the price of each unit in the tier if the charge model is tiered
/volume
pricing.ending_unit_in_decimal
of the next lower tier. Returned only when the line_items.pricing_model
is tiered
, volume
or stairstep
and multi-decimal pricing is enabled.starting_unit_in_decimal
of the next higher tier. Returned only when the line_items.pricing_model
is tiered
, volume
or stairstep and multi-decimal pricing is enabled.line_item
is quantity-based and multi-decimal pricing is enabled.pricing_model
is tiered
or volume
. When the pricing_model
is stairstep
, it is the decimal representation of the total price for line_item
. The value is in major units of the currency. Returned when the line_item
is quantity-based and multi-decimal pricing is enabled.Generates an estimate for the 'create subscription' operation. This is similar to the Create Subscription API but no subscription will be created, only an estimate for this operation is created.
In the response,
If the subscription is created in trial/future states, estimate.invoice_estimate will not be present as no immediate invoice would be generated. However, estimate.next_invoice_estimate will be returned which is a preview of the invoice that would be generated at a later date when the subscription becomes 'active'.
Tip
Set the customer[taxability]
attribute as true
and provide any other necessary parameters to compute taxes. Otherwise tax is exempted for the estimate.
curl https://{site}.chargebee.com/api/v2/estimates/create_subscription \ -u {site_api_key}:\ -d subscription[plan_id]="no_trial" \ -d billing_address[line1]="PO Box 9999" \ -d billing_address[city]="Walnut" \ -d billing_address[zip]="91789" \ -d billing_address[country]="US"
curl https://{site}.chargebee.com/api/v2/estimates/create_subscription \ -u {site_api_key}:\ -d subscription[plan_id]="no_trial" \ -d billing_address[line1]="PO Box 9999" \ -d billing_address[city]="Walnut" \ -d billing_address[zip]="91789" \ -d billing_address[country]="US"
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.
taxes
and
line_item_taxes
are computed based on the tax configuration as of this date. The date should not be 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.
start_date
cannot be earlier than 14th February.billing_cycles
or a custom value depending on the site configuration.
trial_end_action
is not defined for the plan.plan_defaultThe action configured for the site at the time when the trial ends, takes effect. This is the default value when trial_end_action
is defined for the plan.activate_subscriptionThe subscription activates and charges are raised for non-metered items.cancel_subscriptionThe subscription cancels.state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
billing_address
country
as XI
(which is United Kingdom - Northern Ireland).billing_address
country
as XI
. That’s the code for United Kingdom - Northern
Ireland. The first two characters of the VAT number in such a case is
XI
by default. However, if the VAT number was registered in UK, the value should be GB
. Set
vat_number_prefix
to GB
for such cases.
true
then the Reverse Charge Mechanism is applicable. This field is applicable only when Australian GST is configured for your site.
entity_code
or exempt_number
attributes if you use Chargebee’s AvaTax for Sales or specify exemption_details
attribute if you use Chargebee’s AvaTax for Communications integration. Tax may still be applied by Avalara for certain values of entity_code
/exempt_number
/exemption_details
based on the state/region/province of the taxable address.contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to renew
.contract_end
, during which the customer is barred from canceling the contract term. The customer is allowed to cancel the contract term via the Self-Serve Portal only before this period. This allows you to have sufficient time for processing the contract term closure
pricing_model
other than flat_fee
.
The price or per-unit-price of the addon. The value depends on the type of currency.
Note:
For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
unit_price
provided is $10period
. Provide the value as a decimal string in major units of the currency. Can be provided only when multi-decimal pricing is enabled.
active
or non-renewing
status. Once set, the value can't be changed. (Addon trial periods must be enabled by Chargebee Support)
pricing_model
other than flat_fee
.
curl https://{site}.chargebee.com/api/v2/customers/__test__KyVnHhSBWl2XD2aV/create_subscription_estimate \ -G \ -u {site_api_key}:\
curl https://{site}.chargebee.com/api/v2/customers/__test__KyVnHhSBWl2XD2aV/create_subscription_estimate \ -G \ -u {site_api_key}:\
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.
taxes
and
line_item_taxes
are computed based on the tax configuration as of this date. The date should not be 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.
start_date
cannot be earlier than 14th February.billing_cycles
or a custom value depending on the site configuration.
trial_end_action
is not defined for the plan.plan_defaultThe action configured for the site at the time when the trial ends, takes effect. This is the default value when trial_end_action
is defined for the plan.activate_subscriptionThe subscription activates and charges are raised for non-metered items.cancel_subscriptionThe subscription cancels.state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to renew
.contract_end
, during which the customer is barred from canceling the contract term. The customer is allowed to cancel the contract term via the Self-Serve Portal only before this period. This allows you to have sufficient time for processing the contract term closure
pricing_model
other than flat_fee
.
The price or per-unit-price of the addon. The value depends on the type of currency.
Note:
For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
unit_price
provided is $10period
. Provide the value as a decimal string in major units of the currency. Can be provided only when multi-decimal pricing is enabled.
active
or non-renewing
status. Once set, the value can't be changed. (Addon trial periods must be enabled by Chargebee Support)
pricing_model
other than flat_fee
.
Generates an estimate for the 'update subscription' operation. The input will be similar to the Update Subscription API but subscription will not be updated, only an estimate will be created.
In the response,
subscription_estimate
: The details of the changed subscription such as status
, 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_term
parameter is true prorate
parameter is false
subscription
or addons
.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 the invoice_immediately
parameter is set to false
.Note: If you have configured EU VAT or Customized taxes, you need to specify the applicable parameters for calculating taxes - billing_address[], shipping_address[], customer[vat_number], customer[taxability] etc. Otherwise tax calculation will be ignored.
curl https://{site}.chargebee.com/api/v2/estimates/update_subscription \ -u {site_api_key}:\ -d subscription[id]="__test__KyVnHhSBWl3M42aj" \ -d subscription[plan_id]="plan1" \ -d billing_address[line1]="PO Box 9999" \ -d billing_address[city]="Walnut" \ -d billing_address[zip]="91789" \ -d billing_address[country]="US"
curl https://{site}.chargebee.com/api/v2/estimates/update_subscription \ -u {site_api_key}:\ -d subscription[id]="__test__KyVnHhSBWl3M42aj" \ -d subscription[plan_id]="plan1" \ -d billing_address[line1]="PO Box 9999" \ -d billing_address[city]="Walnut" \ -d billing_address[zip]="91789" \ -d billing_address[country]="US"
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_date
must be in the past.invoice_date
is 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.changes_scheduled_at
, reactivate_from
, or trial_end
.invoice_immediately
is true
.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.
status
is cancelled
and it is being reactivated via this operation, this is the date/time at which the subscription should be reactivated.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:
changes_scheduled_at
cannot be earlier than 14th February.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
.
true
: Prorated credits or charges are created as applicable for this change.false
: The subscription is changed without creating any credits or charges.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
prorate
set to false
andtrue
will have the subscription reset its term to the current date (provided end_of_term
is false).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.
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.
future
subscription. Applicable only for future
subscriptions.
status
is future
, in_trial
, or cancelled
. Also, the value must not be earlier than changes_scheduled_at
or start_date
. Note: This parameter can be backdated (set to a value in the past) only when the subscription is in cancelled
or in_trial
status
. Do this to keep a record of when the trial ended in case it ended at some point in the past. When trial_end
is backdated, the subscription immediately goes into active
or non_renewing
status.
trial_end_action
is not defined for the plan.plan_defaultThe action configured for the site at the time when the trial ends, takes effect. This is the default value when trial_end_action
is defined for the plan.activate_subscriptionThe subscription activates and charges are raised for non-metered items.cancel_subscriptionThe subscription cancels.state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
billing_address
country
as XI
(which is United Kingdom - Northern Ireland).billing_address
country
as XI
. That’s the code for United Kingdom - Northern
Ireland. The first two characters of the VAT number in such a case is
XI
by default. However, if the VAT number was registered in UK, the value should be GB
. Set
vat_number_prefix
to GB
for such cases.
true
then the Reverse Charge Mechanism is applicable. This field is applicable only when Australian GST is configured for your site.
pricing_model
other than flat_fee
.
The price or per-unit-price of the addon. The value depends on the type of currency.
Note:
For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
unit_price
provided is $10period
. Provide the value as a decimal string in major units of the currency. Can be provided only when multi-decimal pricing is enabled.
replace_addon_list
. (Addon trial periods must be enabled by Chargebee Support.)
pricing_model
other than flat_fee
.
This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons.
In the response,
The generated 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.
To exclude the delayed charges from the invoice estimate, specify 'false' for the parameter include_delayed_charges.
Note:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkzpS2Zo/renewal_estimate \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkzpS2Zo/renewal_estimate \ -u {site_api_key}:
This API is used to generate an invoice estimate for preview. Estimate details include the number of billing cycles to be invoiced in advance, the number of billing cycles in one interval, advance invoicing schedules, and so on.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVkjcSAl6gBw1/advance_invoice_estimate \ -u {site_api_key}:\ -d invoice_immediately="false" \ -d terms_to_charge=3
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVkjcSAl6gBw1/advance_invoice_estimate \ -u {site_api_key}:\ -d invoice_immediately="false" \ -d terms_to_charge=3
schedule_type = immediate
: the number of future billing cycles to be invoiced in advance. The invoicing is done for the remaining_billing_cycles
of the subscription if that is less than terms_to_charge
.schedule_type = fixed_intervals
: The number of future billing cycles in one interval. The schedule is created such that the total number of billing cycles in the schedule does not exceed the remaining_billing_cycles of the subscription.unbilled_charges
. Applicable only when schedule_type
is immediate
.
terms_to_charge
.specific_datesCharge on specific dates. For each date, specify the number of billing cycles to charge for. Up to 5 dates can be configured.fixed_intervalsCharge at fixed intervals of time. Specify the number of billing cycles that constitute an interval and the number of days before each interval that the invoice should be generated. Also specify when the schedule should end.remaining_billing_cycles
of the subscription. This parameter is applicable only when fixed_interval_schedule[end_schedule_on]
= after_number_of_intervals
specified number of times
specific_dateEnd the advance invoicing schedule on a specific date
.subscription_endAdvance invoices are generated for as long as the subscription is active.fixed_interval_schedule[end_schedule_on]
= specific_date
.
schedule_type
is specific_dates.
schedule_type
is specific_dates
.
Regenerates the invoice for the current term of the subscription. The subscription must have status
as active
or non_renewing
. This operation is not allowed when any of the following conditions hold true for the subscription:
status
is not voided
. Returns an estimate
object with one of the following components depending on the value of invoice_immediately
.
true
: an invoice_estimate
object that corresponds to the regenerated invoice. false
: a list of unbilled_charge_estimate
objects corresponding to all the unbilled charges created for the current term of the subscription. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnOuSHufvfo16/regenerate_invoice_estimate \ -X POST \ -u {site_api_key}:\ -d invoice_immediately="true"
date_from
and date_to
. Should not be passed without date_from
and date_to
.
false
to leave the current term charge for the subscription as unbilled. Once you have done this for all suitable subscriptions of the customer, call Create an invoice for unbilled charges to invoice them.
Estimate of the upcoming scheduled invoices (subscription activations, renewals etc) of a customer. For now preview of the invoices generated on the immediate upcoming date is supported. Say a customer has couple of subscription renewals scheduled on Jan,10th and another subscription renewal scheduled on Jan,15th. This API gives the preview of all the invoices scheduled to be generated on Jan,10th (immediate upcoming date).
In the response:
Note: If consolidated invoicing is enabled you may use this API to test whether upcoming renewals are consolidated.
curl https://{site}.chargebee.com/api/v2/customers/__test__KyVnHhSBWl2pw2aa/upcoming_invoices_estimate \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/customers/__test__KyVnHhSBWl2pw2aa/upcoming_invoices_estimate \ -u {site_api_key}:
Generates an estimate for the 'change term end' operation. This is similar to the Change term end API but the subscription’s term end will not be changed, only an estimate for this operation is created. This is applicable only for subscriptions in ‘in-trial’, ‘active’ and ‘non-renewing’ states.
In the response,
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkzRq2Zh/change_term_end_estimate \ -u {site_api_key}:\ -d term_ends_at=1566697500
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkzRq2Zh/change_term_end_estimate \ -u {site_api_key}:\ -d term_ends_at=1566697500
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.
Generates an estimate for the 'cancel subscription' operation. This is similar to the Cancel a subscription API, but the subscription will not be cancelled. Only an estimate for this operation is created.
In the response,
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkz4Y2Za/cancel_subscription_estimate \ -X POST \ -u {site_api_key}:\ -d end_of_term="true"
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkz4Y2Za/cancel_subscription_estimate \ -X POST \ -u {site_api_key}:\ -d end_of_term="true"
true
if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription status
changes to non_renewing
.
end_of_term
is passed as true
. cancel_at
can be set to a value in the past. This is called backdating. Use backdating when the subscription has been canceled already but its billing has been delayed. The following prerequisites must be met to allow backdating:
current_term_start
.changes_scheduled_at
cannot be earlier than 14th February.end_of_term
= false
), specify how to provide credits for current term charges. When not provided, the site default is considered.end_of_term
= false
), specify how to handle any unbilled charges. When not provided, the site default is considered.terminate_immediately
immediately does the following:status
to terminated
.end_of_contract_term
Sets the contract_term[action_at_term_end]
to cancel
. In other words, the contract term is not renewed and the subscription is canceled at the end of the contract term.create_pending_invoices
is 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_date
must be in the past.invoice_date
is 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.cancel_at
.id
of the event-based addon that represents the termination fee.
This API provides an estimate of the details pertaining to the pause_subscription
operation. It returns attributes such as pause_date
and resume_date
. This is similar to the Pause a subscription API with the exception that the subscription is not paused. Only an estimate for this operation is created.
In the response,
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWl1SO2aC/pause_subscription_estimate \ -X POST \ -u {site_api_key}:\ -d pause_option="specific_date" \ -d subscription[pause_date]=1566698400
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWl1SO2aC/pause_subscription_estimate \ -X POST \ -u {site_api_key}:\ -d pause_option="specific_date" \ -d subscription[pause_date]=1566698400
Pause at the end of the current term, and resume automatically after the number of billing cycles you specify in skip_billing_cycles
Applicable when unbilled charges are present for the subscription and pause_option
is set as immediately
. Note: On the invoice raised, an automatic charge is attempted on the payment method available, if customer's auto-collection property is set to on
.
Retain as unbilled
If no_action
is chosen, charges are added to the resumption invoice.
Invoice charges
If invoice
is chosen, an automatic charge is attempted on the payment method available if the customer has enabled auto-collection. If a payment collection fails or when auto-collection is not enabled, the invoice is closed as unpaid.
paused
state, it is the date/time when the subscription was paused.
Generates an estimate for the 'resume subscription' operation. This is similar to the Resume a subscription API, but the subscription will not be resumed. Only an estimate for this operation is created.
In the response,
++What is an "in-term resumption"?
An “in-term resumption” is when the resumption happens within the billing term of the subscription.
The generated invoice_estimate/next_invoice_estimate will include all the balances - Promotional Credits, Refundable Credits, and Excess Payments - if any.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__sZEDgk5GSLmdy3v6t/resume_subscription_estimate \ -X POST \ -u {site_api_key}:\ -d resume_option="immediately"
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__sZEDgk5GSLmdy3v6t/resume_subscription_estimate \ -X POST \ -u {site_api_key}:\ -d resume_option="immediately"
Generates an estimate for the 'create a gift' operation. This is similar to the Create a gift API, but the gift subscription will not be created. Only an estimate for this operation is created.
In the response,
curl https://{site}.chargebee.com/api/v2/estimates/gift_subscription \ -u {site_api_key}:\ -d subscription[plan_id]="GiftPlan$100" \ -d gifter[customer_id]="gifter" \ -d gifter[signature]="Sam" \ -d gift_receiver[customer_id]="receiver" \ -d gift_receiver[first_name]="James" \ -d gift_receiver[last_name]="William" \ -d gift_receiver[email]="james@user.com"
curl https://{site}.chargebee.com/api/v2/estimates/gift_subscription \ -u {site_api_key}:\ -d subscription[plan_id]="GiftPlan$100" \ -d gifter[customer_id]="gifter" \ -d gifter[signature]="Sam" \ -d gift_receiver[customer_id]="receiver" \ -d gift_receiver[first_name]="James" \ -d gift_receiver[last_name]="William" \ -d gift_receiver[email]="james@user.com"
true
, the claim happens automatically. When not passed, the default value in the site settings is used.
true
, indicates that the gift does not expire. Do not pass or pass as false
when auto_claim
is set.
scheduled_at
. If the gift is not claimed within claim_expiry_date
, it will expire and the subscription will move to cancelled
state. When not passed, the value specified in the site settings will be used.
Pass as NULL
or do not pass when auto_claim
or no_expiry
are set.
checkout_com
: While adding a new payment method using permanent token or passing raw card details to Checkout.com, document
ID and country_of_residence
are required to support payments through dLocal.payer
: User related information.country_of_residence
: This is required since the billing country associated with the user’s payment method may not be the same as their country of residence. Hence the user’s country of residence needs to be specified. The country code should be a two-character ISO code.document
: Document ID is the user’s identification number based on their country.bluesnap
: While passing raw card details to BlueSnap, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.braintree
: While passing raw card details to Braintree, your fraud_merchant_id
and the user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.fraud_merchant_id
: Your merchant ID for fraud detection.chargebee_payments
: While passing raw card details to Chargebee Payments, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
state_code
is provided.
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
pricing_model
other than flat_fee
.
Generates an estimate for the 'create an invoice' operation. This is similar to the Create an invoice API, but the invoice will not be generated. Only an estimate for this operation is created.
In the response,
curl https://{site}.chargebee.com/api/v2/estimates/create_invoice \ -u {site_api_key}:\ -d invoice[customer_id]="__test__KyVnHhSBWl0D02Zw" \ -d charges[amount][0]=1000 \ -d charges[description][0]="Adhoc charge"
curl https://{site}.chargebee.com/api/v2/estimates/create_invoice \ -u {site_api_key}:\ -d invoice[customer_id]="__test__KyVnHhSBWl0D02Zw" \ -d charges[amount][0]=1000 \ -d charges[description][0]="Adhoc charge"
taxes
and
line_item_taxes
are computed based on the tax configuration as of this date. The date should not be 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.
state_code
as AZ
(not US-AZ
). For Tamil Nadu (India), set as TN
(not IN-TN
). For British Columbia (Canada), set as BC
(not CA-BC
).
state_code
is provided.
Brexit
If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then XI
(the code for United Kingdom – Northern Ireland) is available as an option.
pricing_model
other than flat_fee
.
The price or per-unit-price of the addon. The value depends on the type of currency.
Note:
For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
unit_price
provided is $10The decimal representation of the price or per-unit price of the addon. The value is in major units of the currency. Always returned when multi-decimal pricing is enabled.
Note:
For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
unit_price_in_decimal
provided is $10.75remove_general_note
parameter.