A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are:
The charges in a subscription are billed via invoices.
Chargebee offers two billing frequency options for subscriptions:
Plan-based billing (default): Subscriptions are billed based on the billing period defined for the item price of the item_type plan. Learn more.
Multi-frequency billing: Subscriptions are billed according to the billing period of each recurring item price within the subscription. Learn more.
Important
Limitations of Multi-frequency billing.
Private Beta
Multi-frequency billing is in private beta. Please reach out to the Chargebee support to enable this feature.
The selection of the billing frequency preference is configured at the site level.
When creating or updating a subscription, one of the item prices specified under subscription_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions:
period_unit for plan-item price | Compatible period_unit for addon-item price | Compatible period for addon-item price |
|---|---|---|
day | day | The Example If the |
week | week or day | The Example
If the
|
month | month | The Example If the |
year | year or month | The Example If the
|
Anrok: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation
| Field ID | Field Value | APIs |
|---|---|---|
additionalTaxRegistrationNumber | Canadian tax registration numbers in comma separated fashion. | APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. |
Vertex: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration
Note:
Field Id like customerCode
, customerClass
, andtaxExempted
belong to the customer object.
Field Id like productCode
, productClass
, productTaxCode
, and productClass
belong to the product object.
| Field ID | Field Value | APIs |
|---|---|---|
productCode | Merchant to configure it on Vertex Platform | APIs having Plan(PC1), Addons(PC1) and Item Prices(PC2) attributes. |
productClass | ||
customerCode | APIs involving customer attributes. Also includes APIs where we are creating new customers. For example: estimate, subscription, hosted pages. | |
customerClass |
Taxamo: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration
| Field Id | Field Value | APIs |
|---|---|---|
productTaxCode | Merchant to configure it on Taxamo Platform | APIs having Plan(PC1), Addons(PC1) and Item Prices(PC2) attributes. |
productClass | ||
taxExempted | APIs involving customer attributes. Also includes APIs where we are creating new customers. For example: estimate, subscription, hosted pages. |
cbtaxes: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India.
| Field ID | Field Value | APIs |
|---|---|---|
indiaSez | SEZ_IGST_TAX | APIs involving customer attributes. Also includes APIs where we are creating new customers. For example: estimate, subscription, hosted pages. |
SEZ_ZERO_RATED_TAX | ||
indiaExport | EXPORT_IGST_TAX | |
EXPORT_ZERO_RATED_TAX |
All: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level
| Field ID | Field Value | APIs |
|---|---|---|
priceType | TAX_INCLUSIVE | APIs involving customer attributes. Also includes APIs where we are creating new customers. For example: estimate, subscription, hosted pages. |
TAX_EXCLUSIVE | ||
SITE_DEFAULT or blank | Removes price type override, and allows site level configuration to be used for tax calculation. |
{
"activated_at": 1612890916,
"billing_period": 1,
"billing_period_unit": "month",
"created_at": 1612890916,
"currency_code": "USD",
"current_term_end": 1615310116,
"current_term_start": 1612890916,
"customer_id": "__test__8asukSOXdulGOV",
"deleted": false,
"due_invoices_count": 1,
"due_since": 1612890916,
"has_scheduled_changes": false,
"id": "__test__8asukSOXduqmOY",
"mrr": 0,
"next_billing_at": 1615310116,
"object": "subscription",
"remaining_billing_cycles": 1,
"resource_version": 1612890917000,
"started_at": 1612890916,
"status": "active",
"subscription_items": [
{
"amount": 1000,
"billing_cycles": 1,
"free_quantity": 0,
"item_price_id": "basic-USD",
"item_type": "plan",
"object": "subscription_item",
"quantity": 1,
"unit_price": 1000
},
{
"amount": 100,
"item_price_id": "day-pass-USD",
"item_type": "addon",
"object": "subscription_item",
"quantity": 1,
"unit_price": 100
}
],
"total_dues": 1100,
"updated_at": 1612890917
}The unique identifier of the subscription
resource. You have the option to specify this value when creating a customer. If not specified, Chargebee automatically generates a unique identifier.
Note
In the event that the subscription resource is transferred along with its associated customer resource to a different business entity, Chargebee assigns a new random value as the id for the subscription. The original identifier is preserved for the transferred copy of the subscription resource. (See also: Mechanics of business entity transfer.)
The decimal representation of the quantity of the plan purchased. Returned for quantity-based plans when multi-decimal pricing is enabled.
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.
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.
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
.
If true
, ignores the hierarchy relationship
and uses customer as payment and invoice owner.
Indicates whether there are subscription changes scheduled for the next renewal.
Note
This attribute does not consider changes scheduled through upcoming ramps on the subscription. If changes on the subscription are scheduled only via ramps and not through the Update Subscription API, the value of this attribute remains false.
The free_quantity_in_decimal as set for the plan. Returned for quantity-based plans when multi-decimal pricing is enabled.
The decimal representation of the total amount for the plan, in major units of the currency. Always returned when multi-decimal pricing is enabled.
The Net D value explicitly set for this subscription. Net D is the number of days within which any invoice raised for the subscription must be paid. When an invoice is raised, and this value is unavailable, the net_term_days defined at the customer level is considered.
Note: Present only when the subscription has been transferred between business entities.
Represents the id of the active version of the subscription resource.
Tip
If the id and active_id of a subscription resource are the same, this indicates that you are working with the active version of that subscription resource.
Total number of invoices that are due for payment against the subscription.
Note:
Not supported if consolidated invoicing
is enabled, or when the subscription is for the customer who is in hierarchy
, and the parent of this customer owns and pays for the invoices of the subscription. It is also worth noting that the consolidated invoice amount is not included in the calculation of due_invoices_count
.
Time since this subscription has unpaid invoices. Note: Not supported if consolidated invoicing is enabled, or when the subscription is for the customer who is in hierarchy , and the parent of this customer owns and pays for the invoices of the subscription.
Total invoice due amount for this subscription. The value depends on the type of currency
.
Note:
Not supported if consolidated invoicing
is enabled, or when the subscription is for the customer who is in hierarchy
, and the parent of this customer owns and pays for the invoices of the subscription. It is also worth noting that the consolidated invoice amount is not included in the calculation of total_dues
.
Monthly recurring revenue for the subscription. Updated asynchronously, this value catches up with changes to the subscription in less than a minute. The value depends on the type of currency . Note: This may not return accurate values since updated asynchronously.
Exchange rate used for base currency conversion.This value is updated to the rate configured on your site each time any change is made to the subscription.
A customer-facing note added to all invoices associated with this subscription. This note is one among all the notes displayed on the invoice PDF.
A collection of key-value pairs that provides extra information about the subscription.
Note: There's a character limit of 65,535.
Indicates that the subscription has been deleted when the value is true.
You can retrieve a deleted subscription using the list operation
.
Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in Settings > Configure Chargebee > Reason Codes > Subscriptions > Subscription Cancellation. Must be passed if set as mandatory in the app. The codes are case-sensitive
Indicates whether the invoices for this subscription are generated with a pending status. This attribute is set to true automatically when the subscription has item prices that belong to metered items.
You can also set this to true explicitly using the create/update subscription operations. This is useful in the following scenarios:
Set to false
to override for this subscription, the site-level setting
for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the customer level
.
The unique ID of the business entity of this subscription. This is always the same as the business entity of the customer.
Details of individual item prices that are part of this subscription.
The pricing details of subscription_items
which have pricing_model
as
tiered
, volume
or stairstep
.
List of event based charge items that have already been charged.
List of coupons for this subscription
Shipping address for the subscription.
Referral details if exists for the subscription
Contract terms for this subscription
List of discounts currently attached to the subscription.
Note
duration_type one_time are removed from the list after a single application to the subscription.duration_type limited_period are removed from the list once the specified period expires since their attachment to the subscription.Note:
This endpoint optionally supports 3DS. To use it create
a payment_intent
and provide it via this endpoint.
Creates a new subscription for an existing customer in Chargebee. Any available credits and excess payments for the customer are automatically applied on the invoice.
The unique ID of the business entity this subscription should be linked to. Applicable only when multiple business entities have been created for the site. This must be the same as the business entity of the {customer_id} for the operation to be successful.
Note
An alternative way of passing this parameter is by means of a custom HTTP header.
.
Specifies the number of billing cycles for the subscription. The behavior of the subscription after the billing cycles have completed depends on whether the subscription is on a contract term or not.
billing_cycles is not provided, then the billing cycles set for the plan-item price is used. Moreover, once the billing_cycles have completed, the subscription cancels.billing_cycles is mandatory. Moreover, once the billing_cycles have completed, the behavior of the subscription is determined by the contract_term[action_at_term_end] parameter.Item ids of mandatorily attached addons that are to be removed from the subscription.
Defines Net D for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid.
net_term_days defined at the customer level is considered.
.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:
start_date cannot be earlier than 14th February.
.The number of subscription billing cycles (including the first one) to invoice in advance .
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.
If true
, ignores the hierarchy relationship
and uses customer as payment and invoice owner.
A customer-facing note added to all invoices associated with this subscription. This note is one among all the notes displayed on the invoice PDF.
The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if create_pending_invoices
is set to true
, and if the site is configured to set invoice dates to the date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes
and line_item_taxes
are computed based on the tax configuration as of invoice_date.
When passing this parameter, the following prerequisites must be met:
invoice_date must be in the past.start_date.invoice_immediately is true.
.A collection of key-value pairs that provides extra information about the subscription.
Note: There's a character limit of 65,535.
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.
.
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.
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
.
Indicates whether the invoices for this subscription are generated with a pending status. This attribute is set to true automatically when the subscription has item prices that belong to metered items.
You can also set this to true explicitly using the create/update subscription operations. This is useful in the following scenarios:
Set to false
to override for this subscription, the site-level setting
for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the customer level
.
If you want to bill the usages from the previous billing cycle, set this parameter to true. This is useful if the subscription has moved from another system into Chargebee and you haven't closed the previous cycle's invoice yet. This creates a pending invoice immediately on subscription creation, to which you can add usages for the previous cycle.
If any non-metered items are present for the current term, they're also added to this pending invoice. As with all pending invoices, this invoice is also closed automatically or via an API call. This parameter can be passed only when the create_pending_invoices is true
.
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.
Returns a list of subscriptions meeting all the conditions specified in the filter parameters below.
A unique and immutable identifier for the subscription. If not provided, it is autogenerated. Supported operators : is, is_not, starts_with, in, not_in
Example → id[is_not] = "8gsnbYfsMLds"
Identifier of the customer with whom this subscription is associated. Supported operators : is, is_not, starts_with, in, not_in
Example → customer_id[is] = "8gsnbYfsMLds"
The reason for canceling the subscription. Set by Chargebee automatically.
Possible values are : not_paid, no_card, fraud_review_failed, non_compliant_eu_customer, tax_calculation_failed, currency_incompatible_with_gateway, non_compliant_customerReason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in Settings > Configure Chargebee > Reason Codes > Subscriptions > Subscription Cancellation. Must be passed if set as mandatory in the app. The codes are case-sensitive. Supported operators : is, is_not, starts_with, in, not_in
Example → cancel_reason_code[is] = "Not Paid"
Example → remaining_billing_cycles[is_not] = "3"
Time at which the subscription status
last changed to
active.
For example, this value is updated when an in_trial
or
cancelled
subscription activates.
Supported operators :
after, before, on, between, is_present
Example → activated_at[after] = "1435054328"
The date/time at which the next billing for the subscription happens. This is usually right after current_term_end
unless multiple subscription terms were invoiced in advance using the terms_to_charge
parameter.
Supported operators :
after, before, on, between
Example → next_billing_at[after] = "1435054328"
Time at which subscription was cancelled or is set to be cancelled. Supported operators : after, before, on, between
Example → cancelled_at[after] = "1435054328"
To filter based on updated_at.
This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the sort_by
input parameter as updated_at
for a faster response.
Supported operators :
after, before, on, between
Example → updated_at[after] = "1243545465"
The preferred offline payment method for the subscription.
Possible values are : no_preference, cash, check, bank_transfer, ach_credit, sepa_credit, boleto, us_automated_bank_transfer, eu_automated_bank_transfer, uk_automated_bank_transfer, jp_automated_bank_transfer, mx_automated_bank_transfer, customSet to false
to override for this subscription, the site-level setting
for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the customer level.
If true
, ignores the hierarchy relationship
and uses customer as payment and invoice owner.
The unique ID of the business entity of this subscription. This is always the same as the business entity of the customer.
Supported operators : is, is_not, starts_with
Example → business_entity_id[is_not] = "business_entity_id"
Retrieves a list of contract term resources for the subscription specified in the path.
Warning This API will return an error when multi-frequency billing is enabled.
Retrieves a list of discount
resources currently attached
to a specific subscription. The list is sorted in descending order based on the created_at
timestamp.
Note
This endpoint does not return coupon or coupon_code resources.
Retrieves a subscription.
Caution
This API cannot be used for subscriptions that have ramps.
Retrieves a subscription with the scheduled changes applied.
Note: Only the following attributes are changed
Caution
This API cannot be used for subscriptions that have ramps.
Removes the subscription changes scheduled on next renewal. Advance charges, if any, will be refunded as credits and a new invoice will be generated on renewal.
Note: Cannot be called when the subscription is on a contract term. (That is, when the contract_term.status attribute is active.)
If the subscription is in Non Renewing or In Trial state and is also scheduled to cancel at the end of current term, then this API can be used to remove the scheduled cancellation. When a scheduled cancellation is removed, the subscription will revert to Active or In Trial state, whichever is the state before cancellation was scheduled.
While removing the scheduled cancellation, you may specify the number of billing cycles. If the billing cycle is not specified, the default billing cycle from the plan will be applied on the subscription.
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
.
Caution
If there are scheduled ramps for the subscription, this operation can move the ramps to the draft status when it conflicts with any upcoming ramps.
Removes coupons associated with the subscription. If the param coupon_ids
is not specified, all the coupons linked to the subscription are be removed.
List of coupons to be removed from the subscription. You can provide only coupon_id and not coupon_code .
Note:
payment_intent and provide it via this endpoint.Caution
If the subscription currently includes ramps, it's important to note that any ramps scheduled may move to the draft status due to changes in plan billing frequency, line item, or term end. Carefully review your ramp configurations and the details of the subscription update to prevent any unintended disruptions to the subscription.
Updates the specified subscription by setting the parameters passed. Any parameters not provided are left unmodified. If an invoice is generated for this operation, any available credits and excess payments for the customer are automatically applied.
A list of item IDs representing the mandatorily attached addons associated with the plan to which the subscription is being updated. These addons will be removed from the subscription during the subscription update process.
Updates Net D for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid.
0 or a positive integer: Net D is set explicitly for the subscription to the value provided. The value must be one of those defined in the site configuration.-1: The attribute is reset and therefore not returned by the API. In this case, when an invoice is raised - whether now or later - the net_term_days defined at the customer level is considered.The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if create_pending_invoices
is set to true
, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes and line_item_taxes are computed based on the tax configuration as of invoice_date.
When passing this parameter, the following prerequisites must be met:
invoice_date must be in the past.invoice_date is not 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.changes_scheduled_at, reactivate_from, or trial_end.invoice_immediately is true.
.The time at which the trial has ended or will end for the subscription. Set it to 0 to have no trial period.
Note
status is future, in_trial, or cancelled.changes_scheduled_at or start_date.cancelled or in_trial status. Do this to keep a record of when the trial ended in case it ended at some point in the past. When trial_end is backdated, the subscription immediately goes into active or non_renewing status.The number of subscription billing cycles to invoice in advance.
If a new term is started for the subscription due to this API call, then terms_to_charge
is inclusive of this new term. See description for the force_term_reset
parameter to learn more about when a subscription term is reset.
If the subscription status
is cancelled
and it is being reactivated via this operation, this is the date/time at which the subscription should be reactivated.
Note:
It is recommended not to pass this parameter along with changed_scheduled_at.
reactivate_from
can be backdated (set to a value in the past). Use backdating when the subscription has been reactivated already but its billing has been delayed. Backdating is allowed only when the following prerequisites are met:
changes_scheduled_at cannot be earlier than 14th February.
.Override the billing alignment mode chosen for the site for calendar billing. Only applicable when using calendar billing.
List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes.
If changes_scheduled_at
is in the past, then the currently available coupons can be used even if they were not available as of the date for when the change is scheduled.
true: Prorated credits or charges are created as applicable for this change.false: The subscription is changed without creating any credits or charges.Caveat
For further changes within the same billing term, when prorate is set to true, credits are not created when all the conditions below hold true:
An immediate previous change was made
prorate set to false andCaution This parameter is unavailable when the Subscription Ramps feature is enabled; use Create a ramp API instead.
Set this to true if you want the update to be applied at the end of the current subscription billing cycle.
Say the subscription has the renewal date as 28th of every month. When the plan-item price of the subscription is set to one that has the same billing period as the current plan-item price, the subscription change does not change the term. In other words, the subscription still renews on the 28th. Passing this parameter as true
will have the subscription reset its term to the current date (provided end_of_term
is false).
Note:
When the new plan-item price has a billing period different from the current plan-item price of the subscription, the term is always reset, regardless of the value passed for this parameter.
When the status
of the subscription is cancelled
, this parameter determines whether the subscription is reactivated upon making this API request. Unless passed explicitly as false
, this parameter is implied as true
when you provide the subscription_items
and coupons
parameters.
The Chargebee payment token generated by Chargebee JS.
Note:
The payment token created via Chargebee JS uses the gateway selected through Smart Routing.
Explicitly passing a gateway_id
in this API call will not override the gateway associated with the token.
A customer-facing note added to all invoices associated with this subscription. This note is one among all the notes displayed on the invoice PDF.
A collection of key-value pairs that provides extra information about the subscription.
Note: There's a character limit of 65,535.
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.
.
If true
, ignores the hierarchy relationship
and uses customer as payment and invoice owner.
Caution This parameter cannot be set to a future date when the Subscription Ramps feature is enabled; use Create a ramp API instead.
When change_option
is set to specific_date
, then set the date/time at which the subscription change is to happen or has happened. Note:
It is recommended not to pass this parameter along with reactivate_from.
changes_scheduled_at
can be set to a value in the past. This is called backdating the subscription change and is performed when the subscription change has already been provisioned but its billing 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 typically 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 plan in the subscription is 2 months and today is 14th April, changes_scheduled_at cannot be earlier than 14th February..
Note:
The changes_scheduled_at
parameter does not apply to auto_collection
, shipping_address
, and po_number
; these parameters take effect immediately
when scheduling a subscription update.
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
.
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.
Indicates whether the invoices for this subscription are generated with a pending status. This attribute is set to true automatically when the subscription has item prices that belong to metered items.
You can also set this to true explicitly using the create/update subscription operations. This is useful in the following scenarios:
Set to false
to override for this subscription, the site-level setting
for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the customer level
.
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.
Use this endpoint to adjust when a subscription's current term or trial ends without altering the plan or billing frequency. It is helpful when you need to align renewals to a specific calendar date or extend a trial. Future renewals will follow the new date, keeping the subscription cadence intact.
Subscriptions must be in one of the following status values: in_trial, active, non_renewing.
Subscription
Based on the subscription's status, the following updates are made:
in_trial, the trial_end is set to the new date.active, the current_term_end is set to the new date.non_renewing, the upcoming cancellation date is set to the new date.Invoices and Credit Notes
The API can generate unbilled charges, invoice, or credit notes. You can control the behaviour using prorate and invoice_immediately parameters.
To preview invoices, credits, and dates, use the Change term end estimate endpoint.
Advance Charges
If there are advance charges, then credit notes are issued for the unused portion of the service period.
Scheduled Pause
If the subscription is scheduled to pause at the end of the current term, the pause date is updated to match the new term end date.
Ramps
If subscription ramps are present, this operation moves them to the draft state. Update and reschedule the ramps as needed to keep them in sync.
The request fails with invalid_state if the subscription is not in one of the trial, active, or non_renewing states. Validate the status before invoking this API.
The time at which the current term should end for this subscription. The value must be a date in the future, i.e. later than current time. The value must not be the same as next_billing_at
.
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.
.
Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API.
This API is used to reactivate a cancelled subscription. You may also optionally specify a trial end date, to move the subscription to In Trial state. If trial end is not specified, the subscription will be activated and any applicable charges will be initiated.
Unless the billing cycle is specified, it will be set to plan's default billing cycle.
During an in-term reactivation++, unless the billing cycle is specified, the subscription's remaining billing cycles will be restored. If a trial end date is specified, then the plan's default billing cycle is used.
What is an "in-term reactivation"?
An "in-term reactivation" happens when the billing term of the subscription is retained upon cancellation and reactivation is initiated within that term.
When is the 'billing term' retained for a cancelled subscription?
When dunning (payment failure retry settings) is configured with the last retry configured as
Note : In both cases, the billing term is retained and upon reactivation the subscription will be moved to active state (if the plan does not have a trial period) and no invoice will be generated. Ensure that you collect any unpaid invoices.
Example : A Subscription was billed from 1st to 31st of a month and it was cancelled on the 20th due to one of the above cases (billing term is not reset). If the reactivation happens on 25th then it is considered an in-term reactivation.
Reactivation of a subscription in non_renewing state has been deprecated. To remove a scheduled cancellation of a non_renewing Subscription, use Remove Scheduled Cancellation API. However, if you use reactivate API to remove scheduled cancellation for a non_renewing Subscription, then the status will be set to active and the billing cycle will be set to forever. If any value is passed for trial_end or billing cycle, an error will be thrown. If an invoice gets generated during this operation, available Credits and Excess Payments will be automatically applied. Additional Error Scenarios: If there is a need to create an immediate charge and the collection fails, an error will be thrown.
Providing this parameter indicates that the subscription reactivates with an in_trial
status
and the trial period ends at the date provided. The value must not be earlier than reactivate_from.
Note: This parameter can be backdated (set to a value in the past) only when reactivate_from
has been backdated. Do this to keep a record of when the trial ended in case it ended at some point in the past. When trial_end
is backdated, the subscription immediately goes into active
or non_renewing
status.
The date/time at which the subscription was reactivated. When not provided, the subscription is reactivated immediately on calling this API. The value of this parameter must always be in the past (backdating). Do this when the subscription has already been reactivated and the billing has been delayed. The following prerequisites must be met for this parameter to be passed:
reactivate_from cannot be earlier than 14th February.
.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.
.
The number of subscription billing cycles to invoice in advance.
If a new term is started for the subscription due to this API call, then terms_to_charge
is inclusive of this new term. See description for the force_term_reset
parameter to learn more about when a subscription term is reset.
The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if create_pending_invoices
is true
, and if the site is configured to set invoice dates to the date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes
and line_item_taxes
are computed based on the tax configuration as of invoice_date.
When passing this parameter, the following prerequisites must be met:
invoice_date must be in the past.invoice_date is not 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.reactivate_from or trial_end.invoice_immediately is true.
.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
.
Adds a one time charge to the subscription which will be added to the invoice generated at the end of the current term. If there are any applicable coupons in the subscription, an appropriate discount will be applied.
To collect a charge immediately, use this API.
If any subscription changes happen before the end of the current term, these charges will be collected along with it.
The amount to be charged. The unit depends on the type of currency .
The decimal representation of the amount for the one-time charge. Provide the value in major units of the currency. Can be provided only when multi-decimal pricing is enabled.
Indicates the type of sale carried out. This is applicable only if you use Chargebee's AvaTax for Communications integration.
Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use Chargebee's AvaTax for Communications integration.
Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use Chargebee's AvaTax for Communications integration.
Creates an advance invoice or an advance invoicing schedule. When an advance invoice is generated, and auto_collection is on for the subscription, the payment_source associated with the subscription is charged. Any changes scheduled for the subscription are taken into account automatically while generating an advance invoice. Advance invoices are not generated for a subscription when it is in the paused status. Advance invoices are generated only for non-metered items in a subscription.
non_renewing and cancelled subscriptions.ramps, this API will return error for the following scenarios
schedule_type is specific_dates or fixed_intervalsschedule_type = immediate: the number of future billing cycles to be invoiced in advance. The invoicing is done for the remaining_billing_cycles of the subscription if that is less than terms_to_charge.schedule_type = fixed_intervals: The number of future billing cycles in one interval. The schedule is created such that the total number of billing cycles in the schedule does not exceed the remaining_billing_cycles of the subscription.
.Whether the charge should be invoiced immediately or added to unbilled_charges.
Applicable only when schedule_type
is immediate
.
Caution
This API cannot be used for subscriptions that have ramps.- This API will return an error when multi-frequency billing is enabled.
Modifies the advance invoicing schedule for a subscription.
Caution
ramps.Retrieves the advance_invoice_schedule for a subscription. Note that this endpoint is only applicable for schedule_type = specific_dates or fixed_intervals.
Caution
ramps.Deletes an advance invoicing schedule. When schedule_type = specific_dates, you also have the option of deleting a part of the schedule.
Use this API to regenerate the current-term invoice for a subscription. The new invoice will contain non-metered charges from the current term and metered charges from the previous term. If a customer was billed incorrectly, because of a wrong plan, price, or tax configuration, you can first void or delete the erroneous invoice, update the subscription or usage records, and then run this operation to issue the corrected invoice.
Before regenerating an invoice, ensure the following conditions are met:
status must be active or non_renewing.metered subscribed items for the current term.metered items for the previous term.Current-Term Invoice
Chargebee does not modify the voided or deleted invoice for the current term. Instead, it creates a new invoice.
The new invoice includes:
The new invoice does not include:
If every charge for the current-term has a value of zero, and your site is configured to hide zero-value line items, the invoice is not generated.
If you delete the original invoice, the associated usage data is also deleted. To ensure accurate billing for metered items, add or bulk import usage records before regenerating the invoice.
Payment Collection
If auto-collection is on, Chargebee attempts to collect payment for the regenerated invoice. If the payment collection fails, the invoice regeneration also fails.
Note: Chargebee applies any customer balances, such as unapplied payment from the voided invoice, before attempting to collect the remaining amount.
Order
Any orders associated with the invoice are regenerated automatically when the invoice is regenerated.
Before calling this API, perform the following checks:
status is active or non_renewing.date_from and date_to parameters, ensure that their values fall within the range defined by subscription.current_term_start and subscription.current_term_end.The start date of the period being invoiced. The default value is current_term_start .
The end date of the period being invoiced. The default value is current_term_end .
Only applicable when Consolidated Invoicing
is enabled for the customer. Set to false
to leave the current term charge for the subscription as unbilled.
Once you have done this for all suitable subscriptions of the customer, call Create an invoice for unbilled charges
to invoice them.
Import previous and active contract terms .
For contract terms in active
state, import is allowed only if the associated subscription is active
, in_trial
, future
or non-renewing
.
Warning This API will return an error when multi-frequency billing is enabled.
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
.
Imports one or more unbilled charges into an existing subscription. Use this operation to add usage-based or other unbilled charges recorded in external systems to the subscription.
If you are trying to use this operation on your live site, ensure you have requested Support to enable it, otherwise the API will return an "API not enabled" error.
Invoicing
Accounting Integrations
Imported unbilled charges will not sync with your accounting integration until they are invoiced.
Imports a subscription into Chargebee.
Specifies the IDs of coupons
to be marked as exhausted. This parameter accepts a list of IDs, which must correspond to coupons with a duration_type
of one_time.
Ensure that the IDs included in this parameter do not match any IDs provided in the coupon_ids
parameter.
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.
Defines Net D for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid.
net_term_days defined at the customer level is considered.
.List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes .
The time at which the subscription was activated. A subscription is "activated" when its status changes from any other, to either active or non_renewing.
The following conditions must be satisfied when passing this parameter:
status is active, non_renewing, or paused, activated_at must be on or after trial_end or started_at. Additionally, activated_at must be on or before current_term_start.status is in_trial, activated_at must precede trial_startThis parameter should not be provided when passing status as future or cancelled.
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
.
Set as true
if you want an invoice to be created for the subscription.
active or non_renewing status.current_term_start to current_term_end.A customer-facing note added to all invoices associated with this subscription. This note is one among all the notes displayed on the invoice PDF.
A set of key-value pairs stored as additional information for the subscription. Learn more .
Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in Settings > Configure Chargebee > Reason Codes > Subscriptions > Subscription Cancellation. Must be passed if set as mandatory in the app. The codes are case-sensitive.
Indicates whether the invoices for this subscription are generated with a pending status. This attribute is set to true automatically when the subscription has item prices that belong to metered items.
You can also set this to true explicitly using the create/update subscription operations. This is useful in the following scenarios:
Set to false
to override for this subscription, the site-level setting
for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the customer level
.
Assigns the payment source and sets auto collection state for the subscription.
When you don't pass any input param for this API, payment source and auto collection for the subscription will be the same as the customer's default settings.
Deletes a specified subscription.
This operation schedules the subscription resource for deletion, and it is permanently deleted after a few minutes. If you wish to retain the subscription data but stop further renewals, consider canceling or pausing the subscription instead.
Invoices
All the invoices belonging to this subscription are deleted.
Credit notes
All the credit notes belonging to this subscription are deleted.
Transactions
All the transactions belonging to this subscription are deleted.
Usages
All usages belonging to this subscription are deleted.
Usage events
Deleting a subscription does not delete the associated usage events.
Reporting
The numbers in the following reports are modified when a subscription is deleted: Payments, New Revenue, Signups, Activations, Cancellations, and Refunds.
Integrations
Deleting a subscription may affect any third-party integrations you may have with Chargebee Billing. Review all integrations to assess the impact before proceeding.
Before deleting a subscription, ensure the following:
credit_note.applied_credits.cn_id). For all such credit notes, check if the associated subscription (credit_note.subscription_id) is this subscription. If not, use the Remove credit note from an invoice API to remove the credit note allocation.credit_note.allocations.invoice_id). For all such invoices, check if the associated subscription (invoice.subscription_id) is this subscription. If not, use the Remove credit note from an invoice API to remove the allocation.Use this API to pause an active or non-renewing subscription. When a subscription is paused, it does not renew, and Chargebee does not generate renewal invoices for it. This allows you to temporarily suspend a customer's service without canceling the subscription.
active or non_renewing state can be paused.Subscription
If the pause_option parameter is set to immediately, the subscription's status changes to paused. The next_billing_at, pause_date, and resume_date values are updated based on the input parameters.
Unbilled Charges
If the subscription has unbilled charges and is paused immediately, you can choose to leave the charges unbilled or invoice them. If invoiced, Chargebee attempts payment collection based on the customer's auto-collection settings. If payment fails or auto-collection is not enabled, the invoice is marked as unpaid.
Use the unbilled_charges_handling parameter to set your preference.
Dunning
If the subscription has unpaid invoices in dunning and is paused immediately, you can choose to either stop or continue the dunning process.
Use the invoice_dunning_handling parameter to set your preference.
Scheduled Ramps
Any future subscription ramps (such as price or quantity changes) effective on or after the pause date are automatically deleted.
Advanced Invoices
If the subscription has an advance invoice, Chargebee creates an adjustment credit note if the invoice is unpaid or in a payment-due state. If the invoice is already paid, a refundable credit note is created.
Before calling this API, perform the following checks:
status is active or non_renewing. If it isn't, the API returns an invalid_state_for_pause error.has_scheduled_changes attribute. If true, either remove the scheduled changes before calling the API or avoid the operation. Otherwise, the API returns an operation_failed error.contract_term attribute is not present, or if it is present, that contract_term.status is not active. Otherwise, the API returns an invalid_request error.non_renewing state and you want to set the pause date to a future date, the pause date must be earlier than the cancellation date. If you specify a resume date, it must also be earlier than the cancellation date.Date on which the subscription will be paused. Applicable when specific_date option is chosen in the pause_option field.
For non-renewing subscriptions, pause_date should be before the cancellation date.
Applicable when unbilled charges are present for the subscription and pause_option is set as immediately. Note: On the invoice raised, an automatic charge is attempted on the payment method available, if customer's auto-collection property is set to on.
Handles dunning for invoices already in the dunning cycle when a subscription is paused. Applicable when pause_option is set as immediately.
If invoice is in the dunning cycle, invoice_dunning_handing allows you to stop or continue dunning.
The number of subscription billing cycles that will be skipped. The subscription resumes after the set number of billing cycles have been skipped. This is applicable only when the value of of pause_option
is billing_cycles
.
Cancels the specified subscription.
cancelled or transferred.contract_term_cancel_option instead of cancel_option.Subscription
cancel_option.contract_term_cancel_option.status changes to cancelled when canceled.cancel_option is specified as end_of_term, or if contract_term_cancel_option is specified as end_of_subscription_billing_term, the subscription status changes to non_renewing and the subscription billing_cycles becomes 0.Contract Terms
contract_term_cancel_option.Ramps
If ramps are scheduled for the subscription, this operation deletes any ramps that are set to become effective on or after the subscription's cancellation date-time.
Before calling this API, perform the following checks:
status is not cancelled or transferred.contract_term_cancel_option instead of cancel_option.Cancel a subscription with a contract term
If the subscription has a contract term, you can use the following parameters with this API:
contract_term_cancel_optioncancel_atcredit_option_for_current_term_chargesunbilled_charges_optionaccount_receivables_handlingrefundable_credits_handling(Deprecated) Use cancel_option instead.
Applicable only when the subscription does not have contract terms.
Set this to true if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription status changes to non_renewing.
Specifies the date and time when the subscription should be canceled. Do not use this parameter when end_of_term is set to true.
Applicable only when contract_term_cancel_option is specific_date. Specifies the date and time to cancel the subscription and contract term.
You can set a past date to backdate the cancellation. Backdating is allowed only if the following conditions are met:
current_term_start.cancel_at cannot be earlier than February 14.Specifies how to handle credits for current term charges when canceling immediately (i.e., cancel_option is immediately). If not specified, the site-level setting is used.
Specifies how to handle credits for current term charges when contract_term_cancel_option is terminate_immediately. If not specified, the site-level setting is used.
Specifies how to handle unbilled charges when canceling immediately (i.e., cancel_option is immediately). If not specified, the site-level setting is used.
Specifies how to handle unbilled charges when contract_term_cancel_option is terminate_immediately. If not specified, the site-level setting is used.
Specifies how to handle past due invoices when canceling immediately (i.e., cancel_option is immediately). If not specified, the site-level setting is used.
Specifies how to handle past due invoices when contract_term_cancel_option is terminate_immediately. If not specified, the site-level setting is used.
Specifies how to handle refundable credits when canceling immediately (i.e., cancel_option is immediately). If not specified, the site-level setting is used.
Specifies how to handle refundable credits when contract_term_cancel_option is terminate_immediately. If not specified, the site-level setting is used.
The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if create_pending_invoices
is true
, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes
and line_item_taxes
are computed based on the tax
configuration as of invoice_date.
When passing this parameter, the following prerequisites must be met:
invoice_date must be in the past.invoice_date is not 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.cancel_at.
.Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in Settings > Configure Chargebee > Reason Codes > Subscriptions > Subscription Cancellation. Must be passed if set as mandatory in the app. The codes are case-sensitive.
Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API.
This API is used to resume a paused subscription. On resumption the subscription will be activated and any applicable charges will be initiated.
You could schedule the resumption by passing specific_date parameter in resume_option. If scheduled, the subscription will be resumed on the specific_date and moved to Active state.
For in-term resumption, unless there are scheduled changes, unbilled charges will not be charged.
What is an "in-term resumption"? An "in-term resumption" is when the pause and resumption happens within the billing term of the subscription.
Example : A subscription was billed from 1st to 31st of a month. It was paused on the 20th and resumed before 31st. This is an in-term resumption.
Specifying unpaid_invoices allows you to close invoices of the subscription which have amounts due. The invoices are chosen for payment collection after applying the available credits and excess payments.
If you specify schedule_payment_collection, Chargebee will try to collect payments for overdue invoices, provided that auto_collection is enabled for the subscription. The available payment method is charged. Upon successful payment, the payment_succeeded event is triggered. If the payment collection fails, no further attempts will be made to collect payment on the invoices.
Note: If the invoices of the subscription are consolidated, and any of the subscriptions in the consolidated invoice are cancelled, these invoices will not be selected for collection.
Warning
This API will return an error when multi-frequency billing is enabled.
Applicable when the subscription has past due invoices and resume_option is set as 'immediately'. Allows to collect past due invoices or retain them as unpaid. If 'schedule_payment_collection' option is chosen in this field, remaining refundable credits and excess payments are applied. Note: The payment collection attempt will be asynchronous.
If the subscription is in Active or Non Renewing state and is also scheduled to pause at the end_of_term/specific_date, this API can be used to remove the scheduled pause.
Warning This API will return an error when multi-frequency billing is enabled.
If the subscription is in Paused state and is scheduled to resume on a specific_date, this API can be used to remove the scheduled resumption. When the scheduled resumption is removed, the subscription will remain Paused.
Warning This API will return an error when multi-frequency billing is enabled.
Moves a subscription from one customer to another asynchronously. All related resources such as unbilled_charge, invoice, credit_note, and transaction are also moved to the new customer.
After moving, Chargebee adds a comment to the original customer resource to document the move, including the to_customer_id and the ids of all the resources transferred to the destination customer.
Warning
auto_collection is on, it might fail after this operation. Refer to the warning in copy_payment_source for details.customer resource that is within an account hierarchy relationship.payment_due, pending, or posted associated with the subscription.credit_note resources with the statuses adjusted or refund_due should be associated with the subscription.If the above prerequisites are met, the API call returns a 200 OK response containing the subscription resource as is. However, the actual move operation can take up to five minutes to complete.
To know whether the operation was successful, we recommend that you watch for the subscription_changed event and see if subscription.customer_id has changed.
Note:
Resources linked to the original customer such as unbilled_charge
, invoice
, credit_note
, and transaction
but not
linked to the subscription being moved, are not
moved to the destination customer by this operation.
Specifies the unique ID of the customer resource to which the subscription will be moved.
Note:
If there are multiple business entities
, the customer.business_entity_id
of the destination customer must match the subscription.business_entity_id.
When true:
If the subscription has an associated payment_source:
payment_source resource is created.Note:
Deleting any copy of the payment_source
also deletes the other copies and the details stored at the payment gateway.
When false:
No new payment source is created for the subscription. Moreover, if a payment_source is already linked to the subscription, it gets removed, meaning the subscription.payment_source_id is cleared.
Warning:
When copy_payment_source
is false
and if subscription.auto_collection
is enabled, auto-collection will fail, in turn preventing subscription renewal. To prevent auto-collection failure, link a payment source
to the subscription after this operation.