You are viewing the documentation for Chargebee API V2. If you're using the older version (V1), click here.

When a quote is created, it generates the quoted_subscription resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations.

Sample quoted subscription [ JSON ]

{ "plan_id": "basic", "plan_quantity": 1, "billing_period": 1, "billing_period_unit": "month", "object": "quoted_subscription", "addons": [ { "id": "ssl", "quantity": 1, "unit_price": 495, "object": "addon" }, {..} ], "event_based_addons": [ { "id": "day-pass", "quantity": 2, "unit_price": 200, "on_event": "subscription_creation", "charge_once": true, "object": "event_based_addon" }, {..} ], "coupons": [ { "coupon_id": "plan_addons_coupon", "object": "coupon" }, {..} ] }
id
string, max chars=50
A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
start_date
optional, timestamp(UTC) in seconds
Applicable only when operation_type of the quote is create_subscription_for_customer. For subscriptions in the future status, this is the date/time when the subscription is set to start. The quote can be converted on a date/time after this date. This is called backdating the subscription creation. Backdating is performed when the subscription has already been provisioned but the conversion action has been delayed. Backdating is allowed only when the following prerequisites are met:
  • Backdating is enabled for subscription creation operations.
  • The current day of the month does not exceed the limit set in Chargebee for backdating such operations. This day is typically the day of the month by which the accounting for the previous month must be closed.
  • The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the subscription’s plan is 2 months and today is 14th April, the start_date cannot be earlier than 14th February.

trial_end
optional, timestamp(UTC) in seconds
End of the trial period for the subscription. Presence of this value for 'future' subscription implies the subscription will go into 'in_trial' state when it starts.
remaining_billing_cycles
optional, integer, min=0
  • When the subscription is not on a contract term: this value is the number of billing cycles remaining after the current cycle, at the end of which, the subscription cancels.
  • When the subscription is on a contract term: this value is the number of billing cycles remaining in the contract term after the current billing cycle.

po_number
optional, string, max chars=100
Purchase order number for this subscription.
plan_quantity_in_decimal
optional, string, max chars=33
The decimal representation of the quantity of the plan purchased. Returned for quantity-based plans when multi-decimal pricing is enabled.
plan_unit_price_in_decimal
optional, string, max chars=33
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.
changes_scheduled_at
optional, timestamp(UTC) in seconds
Applicable only when operation_type of the quote is change_subscription. When change_option is set to specific_date, then this is the date/time at which the subscription change is scheduled to occur. The quote can be converted on a date/time after this date. This is called backdating the subscription change and performed when the subscription change has already been provisioned but the conversion action has been delayed. Backdating is allowed only when the following prerequisites are met:
  • Backdating must be enabled for subscription change operations.
  • Only the following changes can be backdated:
    • Changes in the recurring items or their prices.
    • Addition of non-recurring items.
  • Subscription status is active, cancelled, or non_renewing.
  • The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is the day of the month by which the accounting for the previous month must be closed.
  • The date is on or after current_term_start.
  • The date is on or after the last date/time any of the following changes were made:
    • Changes in the recurring items or their prices.
    • Addition of non-recurring items.
  • The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the subscription’s plan is 2 months and today is 14th April, changes_scheduled_at cannot be earlier than 14th February.

change_option
optional, enumerated string
Applicable only when operation_type of the quote is change_subscription. When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out.
Possible values are
end_of_termThe change is scheduled to be carried out at the end of the billing cycle of the subscription.specific_dateThe change is carried out as of changes_scheduled_at.immediatelyThe change is carried out immediately upon quote conversion.
contract_term_billing_cycle_on_renewal
optional, integer, min=1, max=100
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.
optional, list of coupon
List of coupons for this subscription
Coupon attributes
coupon_id
string, max chars=100
Used to uniquely identify the coupon
discounts
Show attributes[+]
optional, list of discount
List of discounts for this quoted subscription.
Discount attributes
id
string, max chars=50
An immutable unique id for the discount. It is always auto-generated.
invoice_name
optional, string, max chars=100
The name of the discount as it should appear on customer-facing pages and documents such as invoices and hosted pages. This is auto-generated based on the type, amount, and currency_code of the discount. For example, it can be 10% off or 10$ off.
type
enumerated string, default=percentage
The type of discount. Possible value are:
Possible values are
fixed_amountThe specified amount will be given as discount.percentageThe specified percentage will be given as discount.
percentage
optional, double, min=0.01, max=100.0
The percentage of the original amount that should be deducted from it. Only applicable when discount.type is percentage.
amount
optional, in cents, min=0
The value of the discount. The format of this value depends on the kind of currency. This is only applicable when discount.type is fixed_amount.
currency_code
optional, string, max chars=3
The currency code (ISO 4217 format) of the discount. This is only applicable when discount.type is fixed_amount.
duration_type
enumerated string, default=forever
Specifies the time duration for which this discount is attached to the subscription.
Possible values are
one_timeThe discount stays attached to the subscription till it is applied on an invoice once. It is removed after that from the subscription.foreverThe discount is attached to the subscription and applied on the invoices till it is explicitly removed.limited_periodThe discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by period and period_unit.
period
optional, integer, min=1
The duration of time for which the discount is attached to the subscription, in period_units. Applicable only when duration_type is limited_period.
period_unit
optional, enumerated string
The unit of time for period. Applicable only when duration_type is limited_period.
Possible values are
dayA period of 24 hours.weekA period of 7 days.monthA period of 1 calendar month.yearA period of 1 calendar year.
included_in_mrr
boolean
The discount is included in MRR calculations for your site. This attribute is only applicable when duration_type is one_time and when the feature is enabled in Chargebee. Also, If the site-level setting is to exclude one-time discounts from MRR calculations, this value is always returned false.
apply_on
enumerated string
The amount on the invoice to which the discount is applied.
Possible values are
invoice_amountThe discount is applied to the invoice sub_total.specific_item_priceThe discount is applied to the invoice.line_item.amount that corresponds to the item price specified by item_price_id.
item_price_id
optional, string, max chars=100
The id of the item price in the subscription to which the discount is to be applied. Relevant only when apply_on = specific_item_price.
created_at
timestamp(UTC) in seconds
Timestamp indicating when this discount is created.
apply_till
optional, timestamp(UTC) in seconds
Specifies till when the limited period discount is applicable. This attribute will be sent in the response only for limited_period duration type discount.
applied_count
optional, integer
Specifies the number of times the discount has been applied.
coupon_id
string, max chars=100

Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.

Note:

When the coupon ID contains a special character; for example: #, the API returns an error. Make sure that you encode the coupon ID in the path parameter before making an API call.


index
integer, min=0, max=4
The index number of the subscription to which the item price is added. Provide a unique number between 0 and 4 (inclusive) for each subscription that is to be created.
subscription_items
Show attributes[+]
optional, list of subscription_item
Details of individual item prices that are part of this subscription
Subscription item attributes
item_price_id
string, max chars=100
The unique identifier of the item price.
item_type
enumerated string
The type of item. There must be one and only one item of type plan in this list.
Possible values are
planPlanaddonAddonchargeCharge
quantity
optional, integer, min=1
The quantity of the item purchased
quantity_in_decimal
optional, string, max chars=33
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.
unit_price
optional, in cents, min=0
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 pricing_model of the item price is flat_fee or per_unit. Also, it is only allowed when price overriding is enabled for the site. The value depends on the type of currency. If changes_scheduled_at is in the past and a unit_price is not passed, then the item price’s current unit price is considered even if the item price did not exist on the date as of when the change is scheduled.
unit_price_in_decimal
optional, string, max chars=33
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.
amount
optional, in cents, min=0
The total amount for the item as determined from unit_price, free_quantity, quantity and item_tiers as applicable. The value depends on the type of currency.
amount_in_decimal
optional, string, max chars=33
The decimal representation of the total amount for the item, in major units of the currency. Always returned when multi-decimal pricing is enabled.
free_quantity
optional, integer, min=0
The free_quantity of the plan-item as specified for the item price.
free_quantity_in_decimal
optional, string, max chars=33
The free_quantity_in_decimal as set for the item price. Returned for quantity-based item prices when multi-decimal pricing is enabled.
trial_end
optional, timestamp(UTC) in seconds
The date/time when the trial period of the item ends. Applies to plan-items and—-when enabled-—addon-items as well.
billing_cycles
optional, integer, min=0
For the plan-item price:
the value determines the number of billing cycles the subscription runs before canceling automatically. If not provided, then the value set for the plan-item price is used.

For addon-item prices:
If addon billing cycles are enabled then this is the number of subscription billing cycles for which the addon is included. If not provided, then the value set under attached addons is used. Further, if that value is not provided, then the value set for the addon-item price is used.
service_period_days
optional, integer, min=1, max=730
The service period of the item in days from the day of charge.
charge_on_event
optional, enumerated string
When charge_on_option option is set to on_event, this parameter specifies the event at which the charge-item is applied to the subscription. This parameter only applies to charge-items.
Possible values are
subscription_creationthe time of creation of the subscription.subscription_trial_startthe time when the trial period of the subscription begins.plan_activationsame as subscription activation, but also includes the case when the plan-item of the subscription is changed.subscription_activationthe moment a subscription enters an active or non-renewing state. Also includes reactivations of canceled subscriptions.contract_terminationwhen a contract term is terminated.
charge_once
optional, boolean
Indicates if the charge-item is to be charged only once or each time the charge_on_event occurs. This parameter only applies to charge-items.
charge_on_option
optional, enumerated string
Indicates when the charge-item is to be charged. This parameter only applies to charge-items.
Possible values are
immediatelyThe item is charged immediately on being added to the subscription.on_eventThe item is charged at the occurrence of the event specified as charge_on_event.
item_tiers
Show attributes[+]
optional, list of item_tier
List of item tier.
Item tier attributes
item_price_id
string, max chars=100
The id of the item price to which this tier belongs.
starting_unit
integer, min=1
The lowest value in the quantity tier.
ending_unit
optional, integer
The highest value in the quantity tier.
price
in cents, default=0, min=0
The per-unit price for the tier when the pricing_model is tiered or volume. The total cost for the item price when the pricing_model is stairstep. The value is in the minor unit of the currency.
starting_unit_in_decimal
optional, string, max chars=33
The decimal representation of the 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.
ending_unit_in_decimal
optional, string, max chars=33
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.
price_in_decimal
optional, string, max chars=33
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.
index
integer, min=0, max=4
The index number of the subscription to which the item price is added. Provide a unique number between 0 and 4 (inclusive) for each subscription that is to be created.
quoted_contract_term
Show attributes[+]
optional, quoted_contract_term
The details of the contract term to be created when this quote is invoiced.
Quoted contract term attributes
contract_start
timestamp(UTC) in seconds
The start date of the contract term
contract_end
timestamp(UTC) in seconds
The end date of the contract term
billing_cycle
integer, min=0
The number of billing cycles of the subscription that the contract term is for.
action_at_term_end
enumerated string, default=renew
Action to be taken when the contract term completes.
Possible values are
renew
  • Contract term completes and a new contract term is started for the number of billing cycles specified in contract_billing_cycle_on_renewal.
  • The action_at_term_end for the new contract term is set to renew.
  • evergreenContract term completes and the subscription renews.cancelContract term completes and subscription is canceled.renew_onceUsed when you want to renew the contract term just once. Does the following:
  • Contract term completes and a new contract term is started for the number of billing cycles specified in contract_billing_cycle_on_renewal.
  • The action_at_term_end for the new contract term is set to cancel.
  • total_contract_value
    in cents, default=0, min=0
    The sum of the totals of all the invoices raised as part of the contract term. For 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.
    cancellation_cutoff_period
    optional, integer
    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