POST /purchases/estimate

Deprecated

The purchase resource and its associated operations on this page are deprecated. Avoid using them in your integrations. The ability to purchase multiple plans in a single subscription will be supported through the Subscriptions API in the future.

Returns an estimate for creating a purchase resource. The operation works exactly like Create a purchase, except that only an estimate resource is returned without an actual purchase resource being created.

Servers

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:

  • "all-disabled"
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:

  • "all-disabled"
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-request-origin-user is ignored.

chargebee-event-email String No

skip only emails

Possible values:

  • "all-disabled"

Request body fields

Name Type Required Description
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.

customer_id String No

The unique identifier of the customer that made this purchase.

discounts Object No

Parameters for discounts

discounts.included_in_mrr[] Array No

For manual discounts, set this to false if this manual discount should be excluded from monthly recurring revenue (MRR) calculations for the site. The following prerequisites must be met to allow this parameter to be passed:

  • The feature must be enabled in Chargebee.
  • The site-level setting must be to include coupons in MRR calculations.

See also:

Applying discounts

discounts.percentage[] Array No

The percentage of the discount. Applicable only for manual discounts. For any given array index i, you must either provide discounts[percentage][i] or discounts[amount][i] and never both.
See also:

Applying discounts

discounts.amount[] Array No

The absolute value of the discount. The currency units in which this value is expressed depends on the type of currency. Applicable only for manual discounts.

For any given array index i, you must either provide discounts[percentage][i] or discounts[amount][i] and never both.
See also:

Applying discounts

discounts.coupon_id[] Array No

The unique ID of a coupon to be applied to the group. Alternatively, you may provide a coupon code. Applicable only for .
See also:

Applying discounts

discounts.index[] Array No

The index or identifier of the group to which this discount or coupon information belongs.

This must be a value from the purchase_items[index] array. When not provided, the coupon is applied to the first invoice only; irrespective of the values set for coupon.duration_typeor coupon.max_redemptions.
See also:

Applying discounts

customer Object No

Parameters for customer

customer.taxability String No

Specifies if the customer is liable for tax * exempt -

  • Customer is exempted from tax. When using Chargebee's native Taxes feature or when using the TaxJar integration, no other action is needed.
  • However, when using our Avalara integration, optionally, specify 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.

* 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:

  • "exempt"
  • "taxable"

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:

  • "d"
  • "c"
  • "b"
  • "a"
  • "med2"
  • "med1"
  • "r"
  • "q"
  • "p"
  • "n"
  • "m"
  • "l"
  • "k"
  • "j"
  • "i"
  • "h"
  • "g"
  • "f"
  • "e"
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 country as XI (which is United Kingdom - Northern Ireland ).

When you have enabled EU VAT in 2021 or have manually enabled the Brexit configuration, you have the option of setting 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.

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.
To know more about what values you need to provide, refer to this Avalara's API document.

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:

  • "residential"
  • "business"
  • "senior_citizen"
  • "industrial"
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 true then the Reverse Charge Mechanism is applicable. This field is applicable only when Australian GST is configured for your site.

subscription_info Object No

Parameters for subscription_info

subscription_info.index[] Array Yes

The index or identifier of the group to which this subscription information belongs. This must be a value from the purchase_items[index] array and the group must be a subscription group.

subscription_info.contract_term_billing_cycle_on_renewal[] Array No

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.

subscription_info.subscription_id[] Array No

When specifying a subscription group, this is the unique identifier of the subscription to be created. This value must be unique for each subscription group.

subscription_info.billing_cycles[] Array 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.

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 ending_unit_in_decimal of the next lower tier. Returned only when the pricing_model is tiered, volume or stairstep and multi-decimal pricing is enabled.

item_tiers.price_in_decimal[] Array No

The decimal representation of the per-unit price for the tier when the pricing_model is tiered or volume. When the pricing_model is stairstep, it is the decimal representation of the total price for the item. The value is in major units of the currency. Returned when the plan is quantity-based and multi-decimal pricing is enabled.

item_tiers.price[] Array No

The per-unit price for the tier when the pricing_model is tiered or volume. When the pricing_model is stairstep, it is the total price of the item. The currency units in which this value is expressed depends on the type of currency.

item_tiers.ending_unit[] Array No

The highest value of quantity in this tier. For all other tiers,it must be equal to the starting_unit_in_decimal of the very next higher tier.

item_tiers.item_price_id[] Array No

The unique ID of the item price to which this tier information belongs. This must be a value from the purchase_items[item_price_id] array.

item_tiers.index[] Array Yes

The index or identifier of the group to which this tier information belongs. This must be a value from the purchase_items[index] array.

item_tiers.starting_unit[] Array No

The lowest value of quantity in this tier; this is zero for the lowest tier. For all other tiers, it is the same as ending_unit_in_decimal of the very next lower 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 starting_unit_in_decimal of the next higher tier. Returned only when the pricing_model is tiered, volume or stairstep and multi-decimal pricing is enabled.

purchase_items Object No

Parameters for purchase_items

purchase_items.unit_amount[] Array No

The price or per unit price of the item. You may provide this only when price overriding is enabled for the site.

purchase_items.item_price_id[] Array Yes

The unique identifier of the item price to be added to the group.

purchase_items.quantity[] Array No

The quantity of the item price. Applicable only when the pricing model of the item price is anything other than flat_fee. You can provide this value whether multi-decimal pricing is enabled or disabled.

purchase_items.quantity_in_decimal[] Array No

The decimal representation of the quantity of the item purchased. By default multi-decimal pricing is enabled for purchase API, it is recommended to use the purchase_items[quantity_in_decimal][0..n] for providing quantity-based item prices when multi-decimal pricing is enabled. When multi-decimal pricing is disabled provide the value in purchase_items[quantity][0..n].

purchase_items.index[] Array Yes

The index or identifier of the group to which the item price belongs. The item prices assigned the same index belong to the same group.

purchase_items.unit_amount_in_decimal[] Array No

The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned when multi-decimal pricing is enabled.

shipping_addresses Object No

Parameters for shipping_addresses

shipping_addresses.first_name[] Array No

The first name of the contact. This parameter is mandatory when providing shipping information.

shipping_addresses.state[] Array No

The state/province name.

shipping_addresses.city[] Array No

The name of the city. This parameter is mandatory when providing shipping information.

shipping_addresses.validation_status[] Array No
shipping_addresses.line2[] Array No

Address line 2

shipping_addresses.line1[] Array No

Address line 1. This parameter is mandatory when providing shipping information.

shipping_addresses.email[] Array No

The email address.

shipping_addresses.last_name[] Array No

The last name of the contact. This parameter is mandatory when providing shipping information.

shipping_addresses.company[] Array No

The company name.

shipping_addresses.line3[] Array No

Address line 3

shipping_addresses.state_code[] Array 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 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).

shipping_addresses.zip[] Array No

Zip or postal code. The number of characters is validated according to the rules specified here. This parameter is mandatory when providing shipping information.

shipping_addresses.phone[] Array No

The phone number.

shipping_addresses.country[] Array No

The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code. This parameter is mandatory when providing shipping information.

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 XI (the code for United Kingdom -- Northern Ireland) is available as an option.

contract_terms Object No

Parameters for contract_terms

contract_terms.action_at_term_end[] Array No
contract_terms.index[] Array Yes

The index number of the subscription/one-time group to which the item price is added. Provide a unique number between 0 and 9 (inclusive) for each group that is to be created. To increase this limit, contact Chargebee Support

contract_terms.cancellation_cutoff_period[] Array No

The number of days before 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

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 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).

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 XI (the code for United Kingdom -- Northern Ireland) is available as an option.

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:

  • "partially_valid"
  • "valid"
  • "not_validated"
  • "invalid"

Default value: "not_validated"

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. 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.
  3. Click Test request to test run your request to the API and see the API's response.