ChargebeeAPI
Join the Chargebee Developers Discord — Connect, ask questions, and build faster.Join

Create subscription estimate

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,

  • estimate.subscription_estimate has the subscription details like the status of the subscription (in_trial, active, etc.), next billing date, and so on.

  • estimate.invoice_estimate has details of the invoice that will be generated immediately. This will not be present if no immediate invoice is generated for this operation.

estimate.next_invoice_estimate has details of the invoice that will be generated on the next billing date of this subscription. This will be present only if no immediate invoice is generated during this operation and this subscription has next billing.

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

  • estimate.unbilled_charge_estimates has details of the unbilled charges. This is returned only if invoice_immediately is set as false. But this is not applicable for the 'Subscription renewal estimate' operation.

Tip

Set the customer[taxability] attribute as true and provide any other necessary parameters to compute taxes. Otherwise tax is exempted for the estimate.

Sample Request

URL Format

POST https://[site].chargebee.com/api/v2/estimates/create_subscription

Input Parameters

billing_cycles
optional, integer, min=0

Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled.

mandatory_addons_to_remove
optional, string, max chars=100

List of addons IDs that are mandatory to the plan and has to be removed from the subscription.

terms_to_charge
optional, integer, min=1

The number of subscription billing cycles (including the first one) to invoice in advance .

billing_alignment_mode
optional, enumerated string

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.

Possible Enum Values
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.

coupon_ids
optional, string, max chars=100

List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes.

invoice_immediately
optional, boolean

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.

.

invoice_date
optional, timestamp(UTC) in seconds

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

client_profile_id
optional, string, max chars=50

Indicates the Client profile id for the customer. This is applicable only if you use Chargebee's AvaTax for Communications integration.

subscription[0..n]
Parameters for subscription
pass parameters as subscription[<param name>]
billing_address[0..n]
Parameters for billing_address
pass parameters as billing_address[<param name>]
shipping_address[0..n]
Parameters for shipping_address
pass parameters as shipping_address[<param name>]
customer[0..n]
Parameters for customer. Multiple customer can be passed by specifying unique indices.
pass parameters as customer[<param name>][<idx:0..n>]
contract_term[0..n]
Parameters for contract_term
pass parameters as contract_term[<param name>]
addons[0..n]
Parameters for addons. Multiple addons can be passed by specifying unique indices.
pass parameters as addons[<param name>][<idx:0..n>]
event_based_addons[0..n]
Parameters for event_based_addons. Multiple event_based_addons can be passed by specifying unique indices.
pass parameters as event_based_addons[<param name>][<idx:0..n>]
tax_providers_fields[0..n]
Parameters for tax_providers_fields. Multiple tax_providers_fields can be passed by specifying unique indices.
pass parameters as tax_providers_fields[<param name>][<idx:0..n>]

Returns

estimateEstimate object
Resource object representing estimate