POST /estimates/create_subscription_for_items
Generates an estimate for creating a subscription when the customer does not exist in Chargebee. This estimate API can be called when the customer has not yet signed up and you want to preview how a new subscription would look like for them.
Note: Estimate operations do not make any changes in Chargebee; hence this API does not create an actual customer
or subscription
record.
The response contains one or more of the following objects:
subscription_estimate
: The subscription details like the status of the subscription (such asin_trial
oractive
), next billing date, and so on.invoice_estimate
:The details of the immediate invoice, if there is one. If the subscription is created intrial
/future
states,invoice_estimate
is unavailable as no immediate invoice is generated.next_invoice_estimate
:This is returned when an immediate invoice is not generated. It contains the details of the invoice that will be generated on the next billing date of the subscription.unbilled_charge_estimates
: This contains the details of charges that have not been invoiced. This is returned only if theinvoice_immediately
parameter is set tofalse
.
Servers
- {protocol}://{site}.{environment}:{port}/api/v2
- {protocol}://{site}-test.{environment}:{port}/api/v2
Request headers
Name | Type | Required | Description |
---|---|---|---|
chargebee-request-origin-device |
String | No |
The device from which the customer has made the request |
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/x-www-form-urlencoded" |
chargebee-event-webhook |
String | No |
skip only webhooks Possible values:
|
chargebee-business-entity-id |
String | No |
If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
chargebee-event-actions |
String | No |
skip all actions to be done on the events Possible values:
|
chargebee-request-origin-user |
String | No |
The email address of your customer/user. Use this when the email address has only ASCII characters. |
chargebee-request-origin-ip |
String | No |
The IP address of the customer where the request originated |
chargebee-request-origin-user-encoded |
String | No |
The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header |
chargebee-event-email |
String | No |
skip only emails Possible values:
|
Request body fields
Name | Type | Required | Description |
---|---|---|---|
shipping_address |
Object | No |
Parameters for shipping_address |
shipping_address.line2 |
String | No |
Address line 2 |
shipping_address.line1 |
String | No |
Address line 1 |
shipping_address.line3 |
String | No |
Address line 3 |
shipping_address.state_code |
String | No |
The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set |
shipping_address.zip |
String | No |
Zip or postal code. The number of characters is validated according to the rules specified here. |
shipping_address.country |
String | No |
The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code. Note : If you enter an invalid country code, the system will return an error. Brexit If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then |
shipping_address.city |
String | No |
The name of the city. |
shipping_address.validation_status |
String | No |
The address verification status. * partially_valid - The address is valid for taxability but has not been validated for shipping. * invalid - Address is invalid. * not_validated - Address is not yet validated. * valid - Address was validated successfully. Possible values:
Default value: "not_validated" |
discounts |
Object | No |
Parameters for discounts |
discounts.apply_on[] |
Array | No | |
discounts.included_in_mrr[] |
Array | No |
The discount is included in MRR calculations for your site. This attribute is only applicable when |
discounts.period_unit[] |
Array | No | |
discounts.percentage[] |
Array | No |
The percentage of the original amount that should be deducted from it. |
discounts.period[] |
Array | No |
The duration of time for which the discount is attached to the subscription, in |
discounts.amount[] |
Array | No |
The value of the discount. The format of this value depends on the kind of currency. |
discounts.duration_type[] |
Array | Yes | |
discounts.item_price_id[] |
Array | No |
The id of the item price in the subscription to which the discount is to be applied. Relevant only when |
subscription |
Object | No |
Parameters for subscription |
subscription.id |
String | No |
A unique and immutable identifier for the subscription. If not provided, it is autogenerated. |
subscription.start_date |
Integer | No |
The date/time at which the subscription is to start. If not provided, the subscription starts immediately. You can provide a value in the past as well. This is called backdating the subscription creation and is done when the subscription has already been provisioned but its billing has been delayed. Backdating is allowed only when the following prerequisites are met:
|
subscription.free_period |
Integer | No |
The period of time by which the first term of the subscription is to be extended free-of-charge. The value must be in multiples of free_period_unit. |
subscription.trial_end_action |
String | No |
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. * activate_subscription - The subscription activates and charges are raised for non-metered items. * cancel_subscription - The subscription cancels. * plan_default - The action configured for the site at the time when the trial ends, takes effect. * site_default - This is the default value. The action configured for the site at the time when the trial ends, takes effect. Possible values:
|
subscription.trial_end |
Integer | No |
End of the trial period for the subscription. This overrides the trial period set for the plan-item. The value must be later than |
subscription.free_period_unit |
String | No |
The unit of time in multiples of which the free_period parameter is expressed. The value must be equal to or lower than the period_unit attribute of the plan chosen. * year - Charge based on year(s) * day - Charge based on day(s) * month - Charge based on month(s) * week - Charge based on week(s) Possible values:
|
subscription.contract_term_billing_cycle_on_renewal |
Integer | No |
Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as |
terms_to_charge |
Integer | No |
The number of subscription billing cycles (including the first one) to invoice in advance. |
mandatory_items_to_remove[] |
Array | No |
Item ids of mandatorily attached addons that are to be removed from the subscription. |
subscription_items |
Object | No |
Parameters for subscription_items |
subscription_items.charge_on_event[] |
Array | No | |
subscription_items.unit_price[] |
Array | No |
The price/per unit price of the item. When not provided, the value set for the item price is used. This is only applicable when the |
subscription_items.charge_once[] |
Array | No |
Indicates if the charge-item is to be charged only once or each time the |
subscription_items.charge_on_option[] |
Array | No | |
subscription_items.unit_price_in_decimal[] |
Array | No |
When price overriding is enabled for the site, the price or per-unit price of the item can be set here. The value set for the item price is used by default. Provide the value as a decimal string in major units of the currency. Can be provided only when multi-decimal pricing is enabled. |
subscription_items.item_price_id[] |
Array | Yes |
The unique identifier of the item price. |
subscription_items.quantity[] |
Array | No |
The quantity of the item purchased |
subscription_items.quantity_in_decimal[] |
Array | No |
The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when multi-decimal pricing is enabled. |
subscription_items.service_period_days[] |
Array | No |
The service period of the item in days from the day of charge. |
subscription_items.trial_end[] |
Array | No |
The date/time when the trial period of the item ends. Applies to plan-items and----when enabled----addon-items as well. |
subscription_items.billing_cycles[] |
Array | No |
For the plan-item price: For addon-item prices: |
billing_cycles |
Integer | No |
The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles set for the plan-item price is used. |
coupon_ids[] |
Array | No |
List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
client_profile_id |
String | No |
Indicates the Client profile id for the customer. This is applicable only if you use Chargebee's AvaTax for Communications integration. |
invoice_immediately |
Boolean | No |
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. |
customer |
Object | No |
Parameters for customer |
customer.taxability |
String | No |
Specifies if the customer is liable for tax * exempt -
* taxable - Computes tax for the customer based on the site configuration. In some cases, depending on the region, shipping_address is needed. If not provided, then billing_address is used to compute tax. If that's not available either, the tax is taken as zero. Possible values:
Default value: "taxable" |
customer.entity_code |
String | No |
The exemption category of the customer, for USA and Canada. Applicable if you use Chargebee's AvaTax for Sales integration. * med2 - US Medical Device Excise Tax with taxable sales tax * med1 - US Medical Device Excise Tax with exempt sales tax * b - State government * c - Tribe/Status Indian/Indian Band * a - Federal government * f - Religious organization * g - Resale * d - Foreign diplomat * e - Charitable or benevolent organization * j - Direct pay permit * k - Direct mail * h - Commercial agricultural production * i - Industrial production/manufacturer * n - Local government * l - Other or custom * m - Educational organization * r - Non-resident * p - Commercial aquaculture * q - Commercial Fishery Possible values:
|
customer.exempt_number |
String | No |
Any string value that will cause the sale to be exempted. Use this if your finance team manually verifies and tracks exemption certificates. Applicable if you use Chargebee's AvaTax for Sales integration. |
customer.vat_number_prefix |
String | No |
An overridden value for the first two characters of the full VAT
number. Only applicable specifically for customers with billing_address When you have enabled EU VAT in 2021 or have manually
enabled the Brexit configuration, you have the option of setting billing_address |
customer.exemption_details[] |
Array | No |
Indicates the exemption information. You can customize customer exemption based on specific Location, Tax level (Federal, State, County and Local), Category of Tax or specific Tax Name. This is applicable only if you use Chargebee's AvaTax for Communications integration. |
customer.customer_type |
String | No |
Indicates the type of the customer. This is applicable only if you use Chargebee's AvaTax for Communications integration. * business - When the purchase is made at a place of business * residential - When the purchase is made by a customer for home use * industrial - When the purchase is made by an industrial business * senior_citizen - When the purchase is made by a customer who meets the jurisdiction requirements to be considered a senior citizen and qualifies for senior citizen tax breaks Possible values:
|
customer.vat_number |
String | No |
VAT number of this customer. If not provided then taxes are not calculated for the estimate. Applicable only when taxes are configured for the EU or UK region. VAT validation is not done for this. |
customer.registered_for_gst |
Boolean | No |
Confirms that a customer is registered under GST. If set to |
billing_alignment_mode |
String | No |
Override the billing alignment mode for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site. * immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. * delayed - Subscription period will be aligned with the configured billing date at the next renewal. Possible values:
|
item_tiers |
Object | No |
Parameters for item_tiers |
item_tiers.starting_unit_in_decimal[] |
Array | No |
The decimal representation of the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as |
item_tiers.price_in_decimal[] |
Array | No |
The decimal representation of the per-unit price for the tier when the |
item_tiers.package_size[] |
Array | No |
Package size for the tier when pricing type is |
item_tiers.price[] |
Array | No |
The overridden price of the tier. The value depends on the type of currency. |
item_tiers.ending_unit[] |
Array | No |
The highest value in the quantity tier. |
item_tiers.item_price_id[] |
Array | No |
The id of the item price for which the tier price is being overridden. |
item_tiers.pricing_type[] |
Array | No | |
item_tiers.starting_unit[] |
Array | No |
The lowest value in the quantity tier. |
item_tiers.ending_unit_in_decimal[] |
Array | No |
The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the |
tax_providers_fields |
Object | No |
Parameters for tax_providers_fields |
tax_providers_fields.field_value[] |
Array | No |
The value of the related tax field |
tax_providers_fields.field_id[] |
Array | No |
Field id of the attribute which tax vendor has provided while getting onboarded with Chargebee. |
tax_providers_fields.provider_name[] |
Array | No |
Name of the tax provider. |
invoice_date |
Integer | No |
The document date displayed on the invoice PDF. By default, it is the date of creation of the invoice or, when Metered Billing is enabled, it can be the date of closing the invoice. Provide this value to backdate the invoice (set the invoice date to a value in the past). Backdating an invoice is done for reasons such as booking revenue for a previous date or when the non-recurring charge is effective as of a past date. |
contract_term |
Object | No |
Parameters for contract_term |
contract_term.action_at_term_end |
String | No |
Action to be taken when the contract term completes. * evergreen - Contract term completes and the subscription renews. * renew -
Possible values:
|
contract_term.cancellation_cutoff_period |
Integer | No |
The number of days before Default value: 0 |
billing_address |
Object | No |
Parameters for billing_address |
billing_address.line2 |
String | No |
Address line 2 |
billing_address.line1 |
String | No |
Address line 1 |
billing_address.line3 |
String | No |
Address line 3 |
billing_address.state_code |
String | No |
The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set |
billing_address.zip |
String | No |
Zip or postal code. The number of characters is validated according to the rules specified here. |
billing_address.country |
String | No |
The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code. Note : If you enter an invalid country code, the system will return an error. Brexit If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then |
billing_address.city |
String | No |
The name of the city. |
billing_address.validation_status |
String | No |
The address verification status. * valid - Address was validated successfully. * partially_valid - The address is valid for taxability but has not been validated for shipping. * invalid - Address is invalid. * not_validated - Address is not yet validated. Possible values:
Default value: "not_validated" |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.