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.
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
|
{
"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
}
future
subscription implies the subscription will go into in_trial
state when it starts.trial_end_action
is not defined for the plan.plan_defaultThe action configured for the site at the time when the trial ends, takes effect. This is the default value when trial_end_action
is defined for the plan.activate_subscriptionThe subscription activates and charges are raised for non-metered items.cancel_subscriptionThe subscription cancels.current_term_end
unless multiple subscription terms were invoiced in advance using the terms_to_charge
parameter.null
for future
subscriptions as it is yet to be started.status
last changed to
active
. For example, this value is updated when an in_trial
or
cancelled
subscription activates.billing_cycles
or a custom value depending on the site configuration.true
, ignores the hierarchy relationship and uses customer as payment and invoice owner.paused
state, it is the date/time when the subscription was paused.resource_version
is updated with a new timestamp in milliseconds for every change made to the resource. This attribute will be present only if the resource has been updated after 2016-09-28.true
, there are subscription changes scheduled on next renewal.cancelled
subscriptions or subscriptions that are scheduled for cancellation.due_invoices_count
.total_dues
.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.plan
in this list.pricing_model
of the item price is flat_fee
or per_unit
. Also, it is only allowed when price overriding is enabled for the site. The value depends on the type of currency. If changes_scheduled_at
is in the past and a unit_price
is not passed, then the item price’s current unit price is considered even if the item price did not exist on the date as of when the change is scheduled.unit_price
, free_quantity
, quantity
and item_tiers
as applicable. The value depends on the type of currency.free_quantity_in_decimal
as set for the item price. Returned for quantity-based item prices when multi-decimal pricing is enabled.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
.subscription_items
which have pricing_model
as
tiered
, volume
or stairstep
.pricing_model
is tiered
or volume
. The total cost for the item price when the pricing_model
is stairstep
. The value is in the minor unit of the currency.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.limited_period
coupons only.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
).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.
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
.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_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 closuretype
, amount
, and currency_code
of the discount. For example, it can be 10% off
or 10$ off
.discount.type
is percentage. discount.type
is fixed_amount
. discount.type
is fixed_amount
.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
. 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
.apply_on
= specific_item_price
. limited_period
duration type discount.Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
Note:
When the coupon ID contains a special character; for example: #
, the API returns an error.
Make sure that you encode the coupon ID in the path parameter before making an API call.
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.
start_date
. Set it to 0
to have no trial period.
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
trial_end_action
is not defined for the plan.plan_defaultThe action configured for the site at the time when the trial ends, takes effect. This is the default value when trial_end_action
is defined for the plan.activate_subscriptionThe subscription activates and charges are raised for non-metered items.cancel_subscriptionThe subscription cancels.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.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
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
.discount.type
is percentage.
discount.type
is fixed_amount
.
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.
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"]"
offset
to the value of next_offset
obtained in the previous iteration of the API call.
deleted
as true
.
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.true
, there are subscription changes scheduled on next renewal. Possible values are : true, falseupdated_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, falsetrue
, ignores the hierarchy relationship and uses customer as payment and invoice owner. Possible values are : true, falsecurl 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}:
Returns a list of discounts currently attached to the subscription given by {subscription_id}
. The list is sorted by date of creation, in descending order.
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}:
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}:
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}:
# removes the listed coupons associated with the subscription. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdxPSQY/remove_coupons \ -X POST \ -u {site_api_key}:\ -d coupon_ids[0]="P10DISC"
# removes the listed coupons associated with the subscription. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdxPSQY/remove_coupons \ -X POST \ -u {site_api_key}:\ -d coupon_ids[0]="P10DISC"
payment_intent
and provide it via this endpoint.
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 \ -u {site_api_key}:\ -d subscription_items[item_price_id][0]="basic-USD" \ -d subscription_items[quantity][0]=4 \ -d subscription_items[unit_price][0]=1000 \ -d invoice_immediately="true"
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asrKRrLKtirr/update_for_items \ -u {site_api_key}:\ -d subscription_items[item_price_id][0]="basic-USD" \ -d subscription_items[quantity][0]=4 \ -d subscription_items[unit_price][0]=1000 \ -d invoice_immediately="true"
true
then the existing subscription_items
list for the subscription is replaced by the one provided. If false
then the provided subscription_items
list gets added to the existing list.
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
.future
subscription. Applicable only for future
subscriptions.
status
is future
, in_trial
, or cancelled
. Also, the value must not be earlier than changes_scheduled_at
or start_date
. Note: This parameter can be backdated (set to a value in the past) only when the subscription is in 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
then the existing coupon_ids
list for the subscription is replaced by the one provided. If false
then the provided list gets added to the existing coupon_ids
.
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
andtrue
will have the subscription reset its term to the current date (provided end_of_term
is false). 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
parameter.
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.
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
.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.
trial_end_action
is not defined for the plan.plan_defaultThe action configured for the site at the time when the trial ends, takes effect. This is the default value when trial_end_action
is defined for the plan.activate_subscriptionThe subscription activates and charges are raised for non-metered items.cancel_subscriptionThe subscription cancels.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.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.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.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
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
.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
.discount.type
is percentage.
discount.type
is fixed_amount
.
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.
Changes the subscription's current term end date. Depending on the "status" of the subscription, "term end date" has different effects.
Tip: To cycle through a couple of billing cycles and test webhooks, you may use this API.
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 \ -X POST \ -u {site_api_key}:\ -d invoice_immediately="true" \ -d billing_cycles=4
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdwxyQE/reactivate \ -X POST \ -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.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.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
.
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
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
.
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}:
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.
date_from
and date_to
. Should not be passed without date_from
and date_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.
active
state, import is allowed only if the associated subscription is active
, in_trial
, future
or non-renewing
.curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdvMNOv/import_contract_term \ -X POST \ -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 \ -X POST \ -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/import_unbilled_charges/import_unbilled_charges \ -u {site_api_key}:\ -d unbilled_charges[date_from][1]=1517490271 \ -d unbilled_charges[date_to][1]=1519909471 \ -d unbilled_charges[description][1]="No Trial" \ -d unbilled_charges[unit_amount][1]=4900 \ -d unbilled_charges[quantity][1]=1 \ -d unbilled_charges[entity_id][1]="no-trial" \ -d unbilled_charges[entity_type][1]="plan_item_price"
curl https://{site}.chargebee.com/api/v2/subscriptions/import_unbilled_charges/import_unbilled_charges \ -u {site_api_key}:\ -d unbilled_charges[date_from][1]=1517490271 \ -d unbilled_charges[date_to][1]=1519909471 \ -d unbilled_charges[description][1]="No Trial" \ -d unbilled_charges[unit_amount][1]=4900 \ -d unbilled_charges[quantity][1]=1 \ -d unbilled_charges[entity_id][1]="no-trial" \ -d unbilled_charges[entity_type][1]="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 \ -u {site_api_key}:\ -d subscription_items[item_price_id][0]="basic-USD" \ -d subscription_items[quantity][0]=1 \ -d status="active" \ -d charged_items[item_price_id][0]="ssl-charge-USD" \ -d charged_items[last_charged_at][0]=1516297094 \ -d current_term_end=1593541800
curl https://{site}.chargebee.com/api/v2/customers/__test__8at19S2Bx82rKy/import_for_items \ -u {site_api_key}:\ -d subscription_items[item_price_id][0]="basic-USD" \ -d subscription_items[quantity][0]=1 \ -d status="active" \ -d charged_items[item_price_id][0]="ssl-charge-USD" \ -d charged_items[last_charged_at][0]=1516297094 \ -d current_term_end=1593541800
start_date
. Set it to 0
to have no trial period.
net_term_days
defined at the customer level is considered.Note:
For subscription status: non_renewing
, active
, and paused
, current_term_end
is required.
status
is paused
. When the status
is active
or non_renewing
, it defaults to the current time.
future
subscription, it implies that the subscription goes into in_trial
when it starts.
null
for future
subscriptions as it is yet to be started.
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
.
paused
state, it is the date/time when the subscription was paused.
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
.discount.type
is percentage.
discount.type
is fixed_amount
.
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.
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 \ -X POST \ -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 \ -X POST \ -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. # pauses the subscription on end of term. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdwKMPo/pause \ -X POST \ -u {site_api_key}:\ -d pause_option="end_of_term"
# pauses the subscription on end of term. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdwKMPo/pause \ -X POST \ -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 subscription.
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
. # cancels the subscription after the term ends. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnZKS5y28bL9/cancel_for_items \ -X POST \ -u {site_api_key}:\ -d end_of_term="true"
true
if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription status
changes to non_renewing
.
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.
# resumes a subscription immediately by scheduling payment collection for unpaid # invoices. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdznTS0/resume \ -X POST \ -u {site_api_key}:\ -d resume_option="immediately" \ -d unpaid_invoices_handling="schedule_payment_collection"
# resumes a subscription immediately by scheduling payment collection for unpaid # invoices. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__8asukSOXdznTS0/resume \ -X POST \ -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.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.
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.
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}: