ChargebeeAPI

Estimate for creating a customer and subscription

Try in API Explorer

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 as in_trial or active), next billing date, and so on.
  • invoice_estimate:The details of the immediate invoice, if there is one. If the subscription is created in trial/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 the invoice_immediately parameter is set to false.

Sample Request

URL Format

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

Input Parameters

billing_cycles
optional, integer, min=0

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.

mandatory_items_to_remove
optional, string

Item ids of mandatorily attached addons that are 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

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
optional, string

Parameters for subscription

billing_address
optional, string

Parameters for billing_address

shipping_address
optional, string

Parameters for shipping_address

customer
optional, string

Parameters for customer

contract_term
optional, enumerated string

Parameters for contract_term

subscription_items
optional, string

Parameters for subscription_items

discounts
optional, enumerated string

Parameters for discounts

item_tiers
optional, string

Parameters for item_tiers

tax_providers_fields
optional, string

Parameters for tax_providers_fields

Returns

estimateEstimate object

Resource object representing estimate