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.
Note: The maximum number of subscriptions for any given customer (active
or not) is 900.
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 |
---|---|---|
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
}
subscription
resource. You have the option to specify this value when creating a customer. If not specified, Chargebee automatically generates a unique identifier. 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.)
transferred
status will be reflected on the source business entity's subscription attribute once the customer transfer activity is completed successfully. This status is only valid for product catalog 2.0 as the Multiple Business Entity features can only be enabled for product catalog 2.0.billing_cycles
or a custom value depending on the site configuration. true
, ignores the hierarchy relationship and uses customer as payment and invoice owner. Indicates whether there are subscription changes scheduled for the next renewal.
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
.
Note: Present only when the subscription
has been transferred between business entities.
Represents the id
of the active version of the subscription
resource.
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.
due_invoices_count
. total_dues
. true
. You can retrieve a deleted subscription using the list operation. 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:
Applicable only when Metered Billing is enabled for the site
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. subscription_items
which have pricing_model
as
tiered
, volume
or stairstep
.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.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.
curl https://{site}.chargebee.com/api/v2/customers/__test__8asz8Ru9WhHOJO/subscription_for_items \ -X POST \ -u {site_api_key}:\ -d "subscription_items[item_price_id][0]"="basic-USD" \ -d "subscription_items[billing_cycles][0]"=2 \ -d "subscription_items[quantity][0]"=1 \ -d "subscription_items[item_price_id][1]"="day-pass-USD" \ -d "subscription_items[unit_price][1]"=100
curl https://{site}.chargebee.com/api/v2/customers/__test__8asz8Ru9WhHOJO/subscription_for_items \ -X POST \ -u {site_api_key}:\ -d "subscription_items[item_price_id][0]"="basic-USD" \ -d "subscription_items[billing_cycles][0]"=2 \ -d "subscription_items[quantity][0]"=1 \ -d "subscription_items[item_price_id][1]"="day-pass-USD" \ -d "subscription_items[unit_price][1]"=100
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.
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.net_term_days
defined at the customer level is considered.start_date
cannot be earlier than 14th February.true
, ignores the hierarchy relationship and uses customer as payment and invoice owner. 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.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.
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:
Applicable only when Metered Billing is enabled for the site
.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
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
). state_code
is provided. 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.
checkout_com
: While adding a new payment method using permanent token or passing raw card details to Checkout.com, document
ID and country_of_residence
are required to support payments through dLocal.payer
: User related information.country_of_residence
: This is required since the billing country associated with the user’s payment method may not be the same as their country of residence. Hence the user’s country of residence needs to be specified. The country code should be a two-character ISO code.document
: Document ID is the user’s identification number based on their country.bluesnap
: While passing raw card details to BlueSnap, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.braintree
: While passing raw card details to Braintree, your fraud_merchant_id
and the user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.fraud_merchant_id
: Your merchant ID for fraud detection.chargebee_payments
: While passing raw card details to Chargebee Payments, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.bank_of_america
: While passing raw card details to Bank of America, your user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.ecentric
: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id
parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id
, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part. merchant_id
: Merchant GUID where the card is vaulted or need to be vaulted.ebanx
: While passing raw card details to EBANX, the user's document
is required for some countries and device_session_id
can be added to perform additional validation and avoid fraudulent transactions. payer
: User related information. document
: Document is the user's identification number based on their country. fraud
: Fraud identification related information. device_session_id
: Session ID associated with the user's device contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to renew
.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 -1
to remove this limit. -1
to remove this limit. 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. active
or non-renewing
state. Also includes reactivations of canceled subscriptions.contract_terminationwhen a contract term is terminated.charge_on_event
occurs. This parameter only applies to charge-items. charge_on_event
.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
.period
and period_unit
.period_units
. Applicable only when duration_type
is limited_period
. period
. Applicable only when duration_type
is limited_period
. 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
= specific_item_price
. 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. 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. 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. pricing_type
will be set to flat_fee
by default. For example, if the flat fee for a tier is $100, the customer pays $100 whether they consume 1 unit or the maximum number of units within that tier.packageIndicates that the tier pricing is based on a package of units. Customers are charged for each block or package of units. For example, if the package size is 100 units and the cost per block is $20 consuming 400 units will result in a charge of $80 (4 × $20).curl https://{site}.chargebee.com/api/v2/subscriptions \ -G \ -u {site_api_key}:\ --data-urlencode limit=2 \ --data-urlencode "item_id[in]"=["basic"]
curl https://{site}.chargebee.com/api/v2/subscriptions \ -G \ -u {site_api_key}:\ --data-urlencode limit=2 \ --data-urlencode "item_id[in]"=["basic"]
status
last changed to
active
. For example, this value is updated when an in_trial
or
cancelled
subscription activates. current_term_end
unless multiple subscription terms were invoiced in advance using the terms_to_charge
parameter. 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. 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. Possible values are : true, false true
, ignores the hierarchy relationship and uses customer as payment and invoice owner. Possible values are : true, false This API will return an error when multi-frequency billing is enabled.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdty0Mv/contract_terms \ -G \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdty0Mv/contract_terms \ -G \ -u {site_api_key}:
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.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8at0iSK6IPu41q/discounts \ -G \ -u {site_api_key}:\ --data-urlencode limit=2
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8at0iSK6IPu41q/discounts \ -G \ -u {site_api_key}:\ --data-urlencode limit=2
Retrieves a subscription.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXe0W3SU \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXe0W3SU \ -u {site_api_key}:
This API cannot be used for subscriptions that have ramp
s.
Retrieves a subscription with the scheduled changes applied.
Note: Only the following attributes are changed
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXe0ksSf/retrieve_with_scheduled_changes \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXe0ksSf/retrieve_with_scheduled_changes \ -u {site_api_key}:
This API cannot be used for subscriptions that have ramp
s.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdyTgRH/remove_scheduled_changes \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdyTgRH/remove_scheduled_changes \ -X POST \ -u {site_api_key}:
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.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdy9TR2/remove_scheduled_cancellation \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdy9TR2/remove_scheduled_cancellation \ -X POST \ -u {site_api_key}:
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.
coupon_ids
is not specified, all the coupons linked to the subscription are be removed.curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdxPSQY/remove_coupons \ -u {site_api_key}:\ -d "coupon_ids[0]"="P10DISC"
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdxPSQY/remove_coupons \ -u {site_api_key}:\ -d "coupon_ids[0]"="P10DISC"
payment_intent
and provide it via this endpoint.If the subscription currently includes ramp
s, 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.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asrKRrLKtirr/update_for_items \ -X POST \ -u {site_api_key}:\ -d invoice_immediately=true \ -d "subscription_items[item_price_id][0]"="basic-USD" \ -d "subscription_items[quantity][0]"=4 \ -d "subscription_items[unit_price][0]"=1000
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asrKRrLKtirr/update_for_items \ -X POST \ -u {site_api_key}:\ -d invoice_immediately=true \ -d "subscription_items[item_price_id][0]"="basic-USD" \ -d "subscription_items[quantity][0]"=4 \ -d "subscription_items[unit_price][0]"=1000
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.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.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. status
is cancelled
and it is being reactivated via this operation, this is the date/time at which the subscription should be reactivated.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.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.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
andThis parameter is unavailable when the Subscription Ramps feature is enabled; use Create a ramp API instead.
true
will have the subscription reset its term to the current date (provided end_of_term
is false). 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.
true
, ignores the hierarchy relationship and uses customer as payment and invoice owner. This parameter cannot be set to a future date when the Subscription Ramps feature is enabled; use Create a ramp API instead.
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:
status
is active
, cancelled
, or non_renewing
.current_term_start
.changes_scheduled_at
cannot be earlier than 14th February.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. changes_scheduled_at
. The end_of_term
option is unavailable and specific_date
cannot be set to a future date when the Subscription Ramps feature is enabled; use Create a ramp API instead.
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:
Applicable only when Metered Billing is enabled for the site
.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. 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
). state_code
is provided. 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.
checkout_com
: While adding a new payment method using permanent token or passing raw card details to Checkout.com, document
ID and country_of_residence
are required to support payments through dLocal.payer
: User related information.country_of_residence
: This is required since the billing country associated with the user’s payment method may not be the same as their country of residence. Hence the user’s country of residence needs to be specified. The country code should be a two-character ISO code.document
: Document ID is the user’s identification number based on their country.bluesnap
: While passing raw card details to BlueSnap, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.braintree
: While passing raw card details to Braintree, your fraud_merchant_id
and the user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.fraud_merchant_id
: Your merchant ID for fraud detection.chargebee_payments
: While passing raw card details to Chargebee Payments, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.bank_of_america
: While passing raw card details to Bank of America, your user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.ecentric
: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id
parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id
, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part. merchant_id
: Merchant GUID where the card is vaulted or need to be vaulted.ebanx
: While passing raw card details to EBANX, the user's document
is required for some countries and device_session_id
can be added to perform additional validation and avoid fraudulent transactions. payer
: User related information. document
: Document is the user's identification number based on their country. fraud
: Fraud identification related information. device_session_id
: Session ID associated with the user's device XI
(the code for United Kingdom – Northern
Ireland) is available as an option. checkout_com
: While adding a new payment method using permanent token or passing raw card details to Checkout.com, document
ID and country_of_residence
are required to support payments through dLocal.payer
: User related information.country_of_residence
: This is required since the billing country associated with the user’s payment method may not be the same as their country of residence. Hence the user’s country of residence needs to be specified. The country code should be a two-character ISO code.document
: Document ID is the user’s identification number based on their country.bluesnap
: While passing raw card details to BlueSnap, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.braintree
: While passing raw card details to Braintree, your fraud_merchant_id
and the user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.fraud_merchant_id
: Your merchant ID for fraud detection.chargebee_payments
: While passing raw card details to Chargebee Payments, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.bank_of_america
: While passing raw card details to Bank of America, your user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.ecentric
: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id
parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id
, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part. merchant_id
: Merchant GUID where the card is vaulted or need to be vaulted.ebanx
: While passing raw card details to EBANX, the user's document
is required for some countries and device_session_id
can be added to perform additional validation and avoid fraudulent transactions. payer
: User related information. document
: Document is the user's identification number based on their country. fraud
: Fraud identification related information. device_session_id
: Session ID associated with the user's device checkout_com
: While adding a new payment method using permanent token or passing raw card details to Checkout.com, document
ID and country_of_residence
are required to support payments through dLocal.payer
: User related information.country_of_residence
: This is required since the billing country associated with the user’s payment method may not be the same as their country of residence. Hence the user’s country of residence needs to be specified. The country code should be a two-character ISO code.document
: Document ID is the user’s identification number based on their country.bluesnap
: While passing raw card details to BlueSnap, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.braintree
: While passing raw card details to Braintree, your fraud_merchant_id
and the user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.fraud_merchant_id
: Your merchant ID for fraud detection.chargebee_payments
: While passing raw card details to Chargebee Payments, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.bank_of_america
: While passing raw card details to Bank of America, your user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.ecentric
: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id
parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id
, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part. merchant_id
: Merchant GUID where the card is vaulted or need to be vaulted.ebanx
: While passing raw card details to EBANX, the user's document
is required for some countries and device_session_id
can be added to perform additional validation and avoid fraudulent transactions. payer
: User related information. document
: Document is the user's identification number based on their country. fraud
: Fraud identification related information. device_session_id
: Session ID associated with the user's device 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
). state_code
is provided. 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.
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
). state_code
is provided. 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
country
as
XI
(which is United Kingdom - Northern Ireland), the first two characters of the full VAT
number can be overridden by setting
vat_number_prefix
. billing_address
country
as XI
(which is United Kingdom - Northern Ireland).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. vat_number
of the customer. This helps identify the specific type of customer entity. For example, DE:VAT
is used for a German business entity while DE:LWID45
is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under billing_address.country
. See list of possible values.
Tip:
If there are additional entity identifiers for the customer not associated with the vat_number
, they can be provided as the entity_identifiers[]
array.
true
or not set to any value, the customer is e-invoiced so long as e-invoicing is enabled for their country (billing_address.country
). When set to false
, the customer is not e-invoiced even if e-invoicing is enabled for their country.
Tip:
It is possible to set a value for this flag even when E-Invoicing is disabled. However, it comes into effect only when E-Invoicing is enabled.
entity_identifier_scheme
. Currently only iso6523-actorid-upis
is supported and is used by default when not provided.
Tip:
If there are additional entity identifiers for the customer not associated with the vat_number
, they can be provided as the entity_identifiers[]
array.
true
then the Reverse Charge Mechanism is applicable. This field is applicable only when Australian GST is configured for your site. contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to renew
.contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to cancel
.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 -1
to remove this limit. -1
to remove this limit. 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. changes_scheduled_at
is in the past and a unit_price_in_decimal
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. 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. active
or non-renewing
state. Also includes reactivations of canceled subscriptions.contract_terminationwhen a contract term is terminated.charge_on_event
occurs. This parameter only applies to charge-items. charge_on_event
.Applicable only for item prices with:
item_type
= addon
.pricing_model
= per_unit
.immediately
. subscription.subscription_items
attributes and automatically applies to any additional changes to the addon during the current term. It's removed from the subscription attributes at renewal. You can't alter this parameter's value within the current term via later API calls.prorate
parameter > item_price.proration_type
> site-wide proration setting.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
.period
and period_unit
.period_units
. Applicable only when duration_type
is limited_period
. period
. Applicable only when duration_type
is limited_period
. 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
= specific_item_price
. discounts[id]
) is removed from the subscription. Subsequent invoices will no longer have the discount applied. Tip: If you want to replace a discount, remove
it and add
another in the same API call.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. 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. 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. pricing_type
will be set to flat_fee
by default. For example, if the flat fee for a tier is $100, the customer pays $100 whether they consume 1 unit or the maximum number of units within that tier.packageIndicates that the tier pricing is based on a package of units. Customers are charged for each block or package of units. For example, if the package size is 100 units and the cost per block is $20 consuming 400 units will result in a charge of $80 (4 × $20). Changes the subscription's current term end date. Depending on the status
of the subscription, 'term end date' has different effects.
trial
, it affects trial end date. active
, it affects the next billing date. non_renewing
, this affects the upcoming cancellation date. This API can be used as a way to test subscription renewals and associated webhooks.
This API will return an error when multi-frequency billing is enabled.
ramps
on the subscription by moving the ramps to draft
status. If it is necessary to adjust subscription ramps to align with this operation, update and reschedule them as needed. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdtByMK/change_term_end \ -u {site_api_key}:\ -d term_ends_at=1613413800
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdtByMK/change_term_end \ -u {site_api_key}:\ -d term_ends_at=1613413800
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.
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.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdwxyQE/reactivate \ -u {site_api_key}:\ -d invoice_immediately=true \ -d billing_cycles=4
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdwxyQE/reactivate \ -u {site_api_key}:\ -d invoice_immediately=true \ -d billing_cycles=4
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. reactivate_from
cannot be earlier than 14th February.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.
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. 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
.billing_cycles
or a custom value depending on the site configuration. contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to renew
.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 checkout_com
: While adding a new payment method using permanent token or passing raw card details to Checkout.com, document
ID and country_of_residence
are required to support payments through dLocal.payer
: User related information.country_of_residence
: This is required since the billing country associated with the user’s payment method may not be the same as their country of residence. Hence the user’s country of residence needs to be specified. The country code should be a two-character ISO code.document
: Document ID is the user’s identification number based on their country.bluesnap
: While passing raw card details to BlueSnap, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.braintree
: While passing raw card details to Braintree, your fraud_merchant_id
and the user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.fraud_merchant_id
: Your merchant ID for fraud detection.chargebee_payments
: While passing raw card details to Chargebee Payments, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.bank_of_america
: While passing raw card details to Bank of America, your user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.ecentric
: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id
parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id
, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part. merchant_id
: Merchant GUID where the card is vaulted or need to be vaulted.ebanx
: While passing raw card details to EBANX, the user's document
is required for some countries and device_session_id
can be added to perform additional validation and avoid fraudulent transactions. payer
: User related information. document
: Document is the user's identification number based on their country. fraud
: Fraud identification related information. device_session_id
: Session ID associated with the user's device 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.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXds3JLW/add_charge_at_term_end \ -u {site_api_key}:\ -d amount=300 \ -d description="Service Charge"
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXds3JLW/add_charge_at_term_end \ -u {site_api_key}:\ -d amount=300 \ -d description="Service Charge"
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.ramp
s, this API will return error for the following scenarios schedule_type
is specific_dates
or fixed_intervals
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdtV2MX/charge_future_renewals \ -u {site_api_key}:\ -d terms_to_charge=5
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdtV2MX/charge_future_renewals \ -u {site_api_key}:\ -d terms_to_charge=5
schedule_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.unbilled_charges
. Applicable only when schedule_type
is immediate
. terms_to_charge
.specific_datesCharge on specific dates. For each date, specify the number of billing cycles to charge for. Up to 5 dates can be configured.fixed_intervalsCharge at fixed intervals of time. Specify the number of billing cycles that constitute an interval and the number of days before each interval that the invoice should be generated. Also specify when the schedule should end.remaining_billing_cycles
of the subscription. This parameter is applicable only when fixed_interval_schedule[end_schedule_on]
= after_number_of_intervals
specified number of times
specific_dateEnd the advance invoicing schedule on a specific date
.subscription_endAdvance invoices are generated for as long as the subscription is active.fixed_interval_schedule[end_schedule_on]
= specific_date
. schedule_type
is specific_dates. schedule_type
is specific_dates
. ramp
s.Modifies the advance invoicing schedule for a subscription.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVkmQSCX2vpB3C/edit_advance_invoice_schedule \ -X POST \ -u {site_api_key}:\ -d schedule_type="SPECIFIC_DATES" \ -d "specific_dates_schedule[id][0]"="__test__KyVkmQSCX2vwe3Q" \ -d "specific_dates_schedule[terms_to_charge][0]"=1
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVkmQSCX2w3g3U/edit_advance_invoice_schedule \ -u {site_api_key}:\ -d schedule_type="FIXED_INTERVALS" \ -d "fixed_interval_schedule[days_before_renewal]"=3
remaining_billing_cycles
of the subscription. This parameter is applicable only when fixed_interval_schedule[end_schedule_on]
= after_number_of_intervals
specified number of times
specific_dateEnd the advance invoicing schedule on a specific date
.subscription_endAdvance invoices are generated for as long as the subscription is active.fixed_interval_schedule[end_schedule_on]
= specific_date
. schedule_type
is specific_dates. schedule_type
is specific_dates
. ramp
s.Retrieves the advance_invoice_schedule for a subscription. Note that this endpoint is only applicable for schedule_type = specific_dates or fixed_intervals.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVkmQSCX2wPg43/retrieve_advance_invoice_schedule \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVkmQSCX2wPg43/retrieve_advance_invoice_schedule \ -u {site_api_key}:
ramp
s.Deletes an advance invoicing schedule. When schedule_type = specific_dates, you also have the option of deleting a part of the schedule.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__XpbBsG2SYV7ZMB2K/remove_advance_invoice_schedule \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__XpbBsG2SYV7ZMB2K/remove_advance_invoice_schedule \ -X POST \ -u {site_api_key}:
Regenerates the current invoice for the subscription. The current invoice is that which includes non-metered
items from the current term and metered
items from the previous term of the subscription.
status
must be active
or non_renewing
.metered
items for the current term. metered
items for the previous term. Usages are also deleted when an invoice is deleted. Therefore, if the invoice was deleted, you may add or bulk import usages before regenerating an invoice.
This API will return an error when multi-frequency billing is enabled.
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. active
state, import is allowed only if the associated subscription is active
, in_trial
, future
or non-renewing
.This API will return an error when multi-frequency billing is enabled.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdvMNOv/import_contract_term \ -u {site_api_key}:\ -d "contract_term[action_at_term_end]"="CANCEL" \ -d "contract_term[billing_cycle]"=5 \ -d "contract_term[contract_start]"=1483245610 \ -d "contract_term[contract_end]"=1493613610 \ -d "contract_term[status]"="TERMINATED" \ -d "contract_term[total_contract_value]"=1000
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdvMNOv/import_contract_term \ -u {site_api_key}:\ -d "contract_term[action_at_term_end]"="CANCEL" \ -d "contract_term[billing_cycle]"=5 \ -d "contract_term[contract_start]"=1483245610 \ -d "contract_term[contract_end]"=1493613610 \ -d "contract_term[status]"="TERMINATED" \ -d "contract_term[total_contract_value]"=1000
billing_cycles
or a custom value depending on the site configuration. total_contract_value
total_contract_value_before_tax
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
. total_amount_raised_before_tax
is included in the calculation of the total contract value before tax. It's important to note that this value excludes any applicable taxes. contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to renew
.contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to cancel
.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 curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdvHJGn/import_unbilled_charges \ -X POST \ -u {site_api_key}:\ -d "unbilled_charges[date_from][0]"=1517490271 \ -d "unbilled_charges[date_to][0]"=1519909471 \ -d "unbilled_charges[description][0]"="No Trial" \ -d "unbilled_charges[unit_amount][0]"=4900 \ -d "unbilled_charges[quantity][0]"=1 \ -d "unbilled_charges[entity_id][0]"="no-trial" \ -d "unbilled_charges[entity_type][0]"="PLAN_ITEM_PRICE"
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdvHJGn/import_unbilled_charges \ -X POST \ -u {site_api_key}:\ -d "unbilled_charges[date_from][0]"=1517490271 \ -d "unbilled_charges[date_to][0]"=1519909471 \ -d "unbilled_charges[description][0]"="No Trial" \ -d "unbilled_charges[unit_amount][0]"=4900 \ -d "unbilled_charges[quantity][0]"=1 \ -d "unbilled_charges[entity_id][0]"="no-trial" \ -d "unbilled_charges[entity_type][0]"="PLAN_ITEM_PRICE"
unit_amount_in_decimal
x quantity_in_decimal
. Returned when multi-decimal pricing is enabled. id
is passed as entity_id
.document_level_couponThe deduction is due to a coupon applied to the invoice sub_total
. The coupon id is passed as entity_id
.item_level_discountThe deduction is due to a discount applied to a line item of the invoice. The discount id
is available as the entity_id
. document_level_discountThe deduction is due to a discount applied to the invoice sub_total
. The discount id
is available as the entity_id
. coupon
, then this is the id
of the coupon. Is required when discounts[entity_type]
is item_level_coupon
or document_level_coupon
. stairtstep
pricing , or the price of each unit in the tier if the charge model is tiered
/volume
pricing. ending_unit_in_decimal
of the next lower tier. Returned only when the line_items.pricing_model
is tiered
, volume
or stairstep
and multi-decimal pricing is enabled. starting_unit_in_decimal
of the next higher tier. Returned only when the line_items.pricing_model
is tiered
, volume
or stairstep and multi-decimal pricing is enabled. line_item
is quantity-based and multi-decimal pricing is enabled. pricing_model
is tiered
or volume
. When the pricing_model
is stairstep
, it is the decimal representation of the total price for line_item
. The value is in major units of the currency. Returned when the line_item
is quantity-based and multi-decimal pricing is enabled. Imports a subscription into Chargebee.
curl https://{site}.chargebee.com/api/v2/customers/__test__8at19S2Bx82rKy/import_for_items \ -X POST \ -u {site_api_key}:\ -d status="ACTIVE" \ -d current_term_end=1593541800 \ -d "subscription_items[item_price_id][0]"="basic-USD" \ -d "subscription_items[quantity][0]"=1 \ -d "charged_items[item_price_id][0]"="ssl-charge-USD" \ -d "charged_items[last_charged_at][0]"=1516297094
curl https://{site}.chargebee.com/api/v2/customers/__test__8at19S2Bx82rKy/import_for_items \ -X POST \ -u {site_api_key}:\ -d status="ACTIVE" \ -d current_term_end=1593541800 \ -d "exhausted_coupon_ids[0]"=FESTIVE100 \ -d "subscription_items[item_price_id][0]"="basic-USD" \ -d "subscription_items[quantity][0]"=1 \ -d "charged_items[item_price_id][0]"="ssl-charge-USD" \ -d "charged_items[last_charged_at][0]"=1516297094
duration_type
of one_time
. Ensure that the IDs included in this parameter do not match any IDs provided in the coupon_ids
parameter. net_term_days
defined at the customer level is considered.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_start
This parameter should not be provided when passing status
as future
or cancelled
.
billing_cycles
or a custom value depending on the site configuration. true
if you want an invoice to be created for the subscription.active
or non_renewing
status.current_term_start
to current_term_end
.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:
Applicable only when Metered Billing is enabled for the site
.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. total_contract_value
total_contract_value_before_tax
contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to renew
.contract_billing_cycle_on_renewal
.action_at_term_end
for the new contract term is set to cancel
.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 check
payment_method
. This parameter should be passed only if the invoice is created for current term. 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
). state_code
is provided. 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.
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. 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. active
or non-renewing
state. Also includes reactivations of canceled subscriptions.contract_terminationwhen a contract term is terminated.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
.period
and period_unit
.period_units
. Applicable only when duration_type
is limited_period
. period
. Applicable only when duration_type
is limited_period
. 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
= specific_item_price
. 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. 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. 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. pricing_type
will be set to flat_fee
by default. For example, if the flat fee for a tier is $100, the customer pays $100 whether they consume 1 unit or the maximum number of units within that tier.packageIndicates that the tier pricing is based on a package of units. Customers are charged for each block or package of units. For example, if the package size is 100 units and the cost per block is $20 consuming 400 units will result in a charge of $80 (4 × $20).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.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdw1vPR/override_billing_profile \ -u {site_api_key}:\ -d payment_source_id="pm___test__8asukSOXdwAuPa" \ -d auto_collection="ON"
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdw1vPR/override_billing_profile \ -u {site_api_key}:\ -d payment_source_id="pm___test__8asukSOXdwAuPa" \ -d auto_collection="ON"
Deletes the subscription resource.
This operation is irreversible - all data related to the subscription, such as invoices, transactions, and reports, will be deleted.
Note: This operation schedules the subscription resource for deletion. It will be deleted in a few minutes.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdv6kOj/delete \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdv6kOj/delete \ -X POST \ -u {site_api_key}:
Pauses the subscription, changing its status
to paused
. This prevents the subscription from getting renewed. No new charges are created until the subscription is resumed.
cancelled_at
date. ramp
s scheduled for the subscription, this operation deletes any ramps that are set to become effective on or after the subscription’s pause time.curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdwKMPo/pause \ -u {site_api_key}:\ -d pause_option="END_OF_TERM"
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdwKMPo/pause \ -u {site_api_key}:\ -d pause_option="END_OF_TERM"
Pause at the end of the current term, and resume automatically after the set number of billing cycles (in skip_billing_cycles
) have been skipped
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
.
Retain as unbilled
If no_action
is chosen, charges are added to the resumption invoice.
Invoice charges
If invoice
is chosen, an automatic charge is attempted on the payment method available if the customer has enabled auto-collection. If a payment collection fails or when auto-collection is not enabled, the invoice is closed as unpaid.
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.
pause_option
is billing_cycles
. Cancels the specified subscription.
If there are ramp
s scheduled for the subscription, this operation deletes any ramps that are set to become effective on or after the subscription’s cancellation time.
credit_option_for_current_term_charges
unbilled_charges_option
account_receivables_handling
refundable_credits_handling
end_of_term
or cancel_at
should not be passed when using contract terms; use contract_term_cancel_option
instead. subscription_items
parameter is used to override price or quantity for the termination fee. To use this parameter, the following two conditions must be met: contract_term_cancel_option
must be set to terminate_now
.subscription_items
attribute with charge_on_event
set to contract_term_termination
. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnZKS5y28bL9/cancel_for_items \ -u {site_api_key}:\ -d end_of_term=true
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnZKS5y29FDJ/cancel_for_items \ -u {site_api_key}:\ -d credit_option_for_current_term_charges="PRORATE" \ -d end_of_term=false
end_of_billing_term
is passed, no credits or refunds will be issued upon cancellation.cancel_at
end_of_billing_termThis is used to cancel a subscription either at the end of the advance term, if it's billed for future renewals or at the end of its current billing cycletrue
if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription status
changes to non_renewing
. cancel_option
parameter instead.cancel_option
as end_of_term
to cancel a subscription at the end of the current billing cycle.cancel_option
as immediately
to cancel the subscription with immediate effect.end_of_term
is passed as true
. cancel_at
can be set to a value in the past. This is called backdating. Use backdating when the subscription has been canceled already but its billing has been delayed. The following prerequisites must be met to allow backdating:
current_term_start
.changes_scheduled_at
cannot be earlier than 14th February.end_of_term
= false
), specify how to provide credits for current term charges. When not provided, the site default is considered. end_of_term
= false
), specify how to handle any unbilled charges. When not provided, the site default is considered. terminate_immediately
immediately does the following:status
to terminated
.end_of_contract_term
Sets the contract_term[action_at_term_end]
to cancel
. In other words, the contract term is not renewed and the subscription is canceled at the end of the contract term.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
.id
of the charge item_price that represents the termination fee. 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 specified as schedule_payment_collection, payment collection for the amount due of past invoices will be attempted. The payment method available will be charged if auto-collection is enabled for the customer, and appropriate payment collection(payment succeeded or payment failed) events will be triggered. If the payment collection fails, no further retries will be made 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.
This API will return an error when multi-frequency billing is enabled.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdznTS0/resume \ -u {site_api_key}:\ -d resume_option="IMMEDIATELY" \ -d unpaid_invoices_handling="SCHEDULE_PAYMENT_COLLECTION"
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdznTS0/resume \ -u {site_api_key}:\ -d resume_option="IMMEDIATELY" \ -d unpaid_invoices_handling="SCHEDULE_PAYMENT_COLLECTION"
checkout_com
: While adding a new payment method using permanent token or passing raw card details to Checkout.com, document
ID and country_of_residence
are required to support payments through dLocal.payer
: User related information.country_of_residence
: This is required since the billing country associated with the user’s payment method may not be the same as their country of residence. Hence the user’s country of residence needs to be specified. The country code should be a two-character ISO code.document
: Document ID is the user’s identification number based on their country.bluesnap
: While passing raw card details to BlueSnap, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your BlueSnap fraud session ID required to perform anti-fraud validation.braintree
: While passing raw card details to Braintree, your fraud_merchant_id
and the user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.fraud_merchant_id
: Your merchant ID for fraud detection.chargebee_payments
: While passing raw card details to Chargebee Payments, if fraud_session_id
is added, additional validation is performed to avoid fraudulent transactions.fraud
: Fraud identification related information.fraud_session_id
: Your Chargebee Payments fraud session ID required to perform anti-fraud validation.bank_of_america
: While passing raw card details to Bank of America, your user’s device_session_id
can be added to perform additional validation and avoid fraudulent transactions.fraud
: Fraud identification related information.device_session_id
: Session ID associated with the user's device.ecentric
: This parameter is used to verify and process payment method details in Ecentric. If the merchant_id
parameter is included, Chargebee will vault it / perform a lookup and verification against this merchant_id
, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part. merchant_id
: Merchant GUID where the card is vaulted or need to be vaulted.ebanx
: While passing raw card details to EBANX, the user's document
is required for some countries and device_session_id
can be added to perform additional validation and avoid fraudulent transactions. payer
: User related information. document
: Document is the user's identification number based on their country. fraud
: Fraud identification related information. device_session_id
: Session ID associated with the user's device 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.
This API will return an error when multi-frequency billing is enabled.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdz1ERW/remove_scheduled_pause \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdz1ERW/remove_scheduled_pause \ -X POST \ -u {site_api_key}:
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.
This API will return an error when multi-frequency billing is enabled.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdzOFRl/remove_scheduled_resumption \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdzOFRl/remove_scheduled_resumption \ -X POST \ -u {site_api_key}:
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 id
s of all the resources transferred to the destination customer.
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.
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.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdwKMPo/move \ -u {site_api_key}:\ -d to_customer_id="__test__KyVnHhSBWlCdz2cv" \ -d copy_payment_source=true
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdwKMPo/move \ -u {site_api_key}:\ -d to_customer_id="__test__KyVnHhSBWlCdz2cv" \ -d copy_payment_source=true
Specifies the unique ID of the customer
resource to which the subscription will be moved.
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.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.
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.