Subscription represents the recurring items a customer has subscribed to. The recurring items can be - plan, addons. It may also contain the discount items like coupons.
Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'.
Note: The maximum number of subscriptions for any given customer (active
or not) is 900.
{
"activated_at": 1517505643,
"auto_collection": "off",
"billing_period": 1,
"billing_period_unit": "month",
"created_at": 1517505643,
"currency_code": "USD",
"current_term_end": 1519924843,
"current_term_start": 1517505643,
"customer_id": "__test__KyVnHhSBWkkwI2Tn",
"deleted": false,
"due_invoices_count": 1,
"due_since": 1517505643,
"has_scheduled_changes": false,
"id": "__test__KyVnHhSBWkkwI2Tn",
"mrr": 0,
"next_billing_at": 1519924843,
"object": "subscription",
"plan_amount": 895,
"plan_free_quantity": 0,
"plan_id": "no_trial",
"plan_quantity": 1,
"plan_unit_price": 895,
"resource_version": 1517505643000,
"started_at": 1517505643,
"status": "active",
"total_dues": 895,
"updated_at": 1517505643
}
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.Multiple Business Entities is a feature available only on Product Catalog 2.0.
pricing_model
other than flat_fee
.The price or per-unit-price of the addon. The value depends on the type of currency.
Note:
For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
unit_price
provided is $10active
or non-renewing
status. Once set, the value can't be changed. (Addon trial periods must be enabled by Chargebee Support)The decimal representation of the price or per-unit price of the addon. The value is in major units of the currency. Always returned when multi-decimal pricing is enabled.
Note:
For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
unit_price_in_decimal
provided is $10.75pricing_model
other than flat_fee
.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 closureCreates a new subscription along with the customer. You can attach a plan, plan quantity, one or more addons and coupon while creating this subscription.
If the start_date is specified, the subscription will be created in 'future' state (.ie, instead of starting immediately it will be scheduled to start at the specified 'start_date'). Besides if 'trial' is specified (plan configuration or specified explicitly using trial_end), the subscription will go into 'trial' state when it starts. Otherwise it will directly become 'active' when it starts.
If the plan has trial period or if the trial_end is specified explicitly, the subscription will be created in 'in_trial' state.
If the card details are passed, it is not charged until the end of the trial period. Incase you need to verify the card you could enable the 'card verification option' in the gateway settings.
If the plan does not have a trial period and if any of the recurring items has charges, then a invoice would be raised immediately. If 'auto_collection' is turned 'on', then card attributes are mandatory and subscription will be created only if the payment was successful.
Passing card details to this API involves PCI liability at your end as sensitive card information passes through your servers. If you wish to avoid that, you can use one of the following integration methodologies if applicable
billing_address
and vat_number
of the customer are deleted and replaced by the values passed with this request. Ensure that you pass the billing address parameters and the vat_number
parameters each time you make this request, to avoid losing the same information at the customer-level. billing_address
and vat_number
of the customer.
# creates a subscription with customer information and billing details. curl https://{site}.chargebee.com/api/v2/subscriptions \ -u {site_api_key}:\ -d plan_id="no_trial" \ -d auto_collection="off" \ -d customer[first_name]="John" \ -d customer[last_name]="Doe" \ -d customer[email]="john@user.com" \ -d billing_address[first_name]="John" \ -d billing_address[last_name]="Doe" \ -d billing_address[line1]="PO Box 9999" \ -d billing_address[city]="Walnut" \ -d billing_address[state]="California" \ -d billing_address[zip]="91789" \ -d billing_address[country]="US"
start_date
cannot be earlier than 14th February.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.
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.hosted_page
should be created. When not provided, a new customer is created with the ID set to the value provided for subscription[id]
. If subscription[id]
is unavailable, then the customer ID is autogenerated.
entity_code
or exempt_number
attributes if you use Chargebee’s AvaTax for Sales or specify exemption_details
attribute if you use Chargebee’s AvaTax for Communications integration. Tax may still be applied by Avalara for certain values of entity_code
/exempt_number
/exemption_details
based on the state/region/province of the taxable address.Indicates whether invoices raised on the same day for the customer
are consolidated. When provided, this overrides the default configuration at the site-level. This parameter can be provided only when Consolidated Invoicing is enabled.
Note:
Any invoices raised when a subscription activates from in_trial
or future
status
, are not consolidated by default. Contact Support to enable consolidation for such invoices.
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.
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
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.
true
then the Reverse Charge Mechanism is applicable. This field is applicable only when Australian GST is configured for your site.
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.first_name
:(string, max chars=150) The first name of the contact.last_name
:(string, max chars=150) The last name of the contact.company_name
:(string, max chars=250) The company name for the address.line1
:(string, max chars=180) The first line of the address.line2
:(string, max chars=180) The second line of the address.country
:(string) The name of the country for the address.country_code
:(string, max chars=50) The two-letter, ISO 3166 alpha-2 country code for the address. state
:(string, max chars=50) The name of the state or province for the address. When not provided, this is set automatically for US, Canada, and India.state_code
:(string, max chars=50) The ISO 3166-2 state/province code without the country prefix. This is supported for USA, Canada, and India. For instance, for Arizona (USA), set 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)
.city
:(string, max chars=50) The city name for the address.postal_code
:(string, max chars=20) The postal or ZIP code for the address.phone
:(string, max chars=50) The contact phone number for the address.email
:(string, max chars=70) The contact email address for the address.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.
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
entity_identifier
in Chargebee. When not provided, it is autogenerated.
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 is only one entity identifier for the customer and the value is the same as vat_number
, then there is no need to provide the entity_identifiers[]
array. See description for entity_identifiers[]
.
entity_identifier
. This identifies the customer entity on the Peppol network. For example: 10101010-STO-10
.
Tip:
If there is only one entity identifier for the customer and the value is the same as vat_number
, then there is no need to provide the entity_identifiers[]
array. See description for entity_identifiers[]
.
entity_identifier
scheme
. Currently, only iso6523-actorid-upis
is supported and is used by default when not provided.
Tip:
If there is only one entity identifier for the customer and the value is the same as vat_number
, then there is no need to provide the entity_identifiers[]
array. See description for entity_identifiers[]
.
pricing_model
other than flat_fee
.
active
or non-renewing
status. Once set, the value can't be changed. (Addon trial periods must be enabled by Chargebee Support)
pricing_model
other than flat_fee
.
Creates a new subscription for an existing customer. You can attach a plan, plan quantity, one or more addons and coupon while creating this subscription.
If the plan does not have a trial period and if any of the recurring-item has charges, then the customer is charged immediately if auto_collection is turned 'on'. In that case, subscription is created only if the customer has a payment method on file and attempted payment is successful.
curl https://{site}.chargebee.com/api/v2/customers/__test__KyVnHhSBWkmi22UR/subscriptions \ -u {site_api_key}:\ -d plan_id="no_trial" \ -d shipping_address[first_name]="Mark" \ -d shipping_address[last_name]="Henry" \ -d shipping_address[company]="chargebee" \ -d start_date=1600968050
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.
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
pricing_model
other than flat_fee
.
active
or non-renewing
status. Once set, the value can't be changed. (Addon trial periods must be enabled by Chargebee Support)
pricing_model
other than flat_fee
.
curl https://{site}.chargebee.com/api/v2/subscriptions \ -G \ -u {site_api_key}:\ --data-urlencode limit=2 \ --data-urlencode plan_id[in]="["basic","no_trial"]"
curl https://{site}.chargebee.com/api/v2/subscriptions \ -G \ -u {site_api_key}:\ --data-urlencode limit=2 \ --data-urlencode plan_id[in]="["basic","no_trial"]"
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, falseMultiple Business Entities is a feature available only on Product Catalog 2.0.
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkgjr2SI/contract_terms \ -G \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkv9J2YH \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkv9J2YH \ -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__KyVnHhSBWkvUM2YO/retrieve_with_scheduled_changes \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkvUM2YO/retrieve_with_scheduled_changes \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkt5V2XR/remove_scheduled_changes \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkt5V2XR/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__KyVnHhSBWksgR2XI/remove_scheduled_cancellation \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWksgR2XI/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__KyVnHhSBWkrtw2X0/remove_coupons \ -X POST \ -u {site_api_key}:\ -d coupon_ids[0]="plan_only_coupon"
You can modify the plan, plan quantity and add or remove addons for the subscription. By default the changes are applied immediately and the charges (/credits) are prorated and adjusted with the next billing term. You may also choose to effect the changes at the end of the current term by passing end_of_term as "true". In this case proration will not be done.
Only the parameters that are passed are modified for the subscription. Rest will reflect the existing values.
By default, the addons passed are appended to the existing list of addons for this subscription. In case a passed addon already exists for this subscription, quantity value is replaced. If you want to completely replace the addons for this subscription, pass replace_addon_list as "true".
Card and 'vat_number' attributes can also be passed during subscription update. If they are passed, corresponding Billing Info attributes - the Billing Address and 'vat_number' - will be replaced automatically.
Passing credit card details to this API involves PCI liability at your end as sensitive card info passes through your servers. If you wish to avoid that, you can use one of the following integration methodologies if applicable
Proration Scenario: A customer changes from a $15 plan to $30 plan after 15 days of a monthly term. He will be charged for $7.50 immediately. The following Credit Note and Invoice will be generated
Credit Note | |
Prorated credits for Old Plan | $7.50 |
Invoice | |
Prorated charges for New Plan | $15.00 |
Total | $15.00 |
Credits | ($7.50) |
Amount Due | $7.50 |
Meanwhile downgrading will result in net credits being created which will be applied when the subscription is charged on start of the next term. Learn more about our proration scenarios here.
Billing Cycle: The billing period for a subscription does not change if the plans intervals of both old and new are same. However, if a customer changes to a plan that has different billing interval(say monthly to yearly), the billing period is reset. Customer is charged immediately for the modified subscription after applying credit for the unused period for the old subscription.
Card and VAT number Input: If they are passed, corresponding Billing Address attributes and vat_number will be replaced. i.e existing values for Billing Address and 'vat_number' will be cleared and the new values will be set.
If an invoice gets generated during this operation, available Credits and Excess Payments will be automatically applied.
Advance charges, if any, will be refunded as credits and a new invoice will be generated on renewal.
# updates the subscription's plan and replaces the addons associated with # it .The changes made will be effective from current end # of term. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkvzp2Yd \ -u {site_api_key}:\ -d plan_id="plan1" \ -d addons[id][0]="sub_ssl" \ -d addons[id][1]="sub_monitor" \ -d addons[quantity][1]=2 \ -d end_of_term="true"
changes_scheduled_at
is in the past and a plan_unit_price
is not passed, then the plan’s current unit price is considered even if the plan 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.
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 plan_id
or addons[id]
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.
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
other than flat_fee
.
changes_scheduled_at
is in the past and addons[unit_price][i]
is not passed, then the addon’s current unit price is considered even if the addon did not exist on the date as of when the change is scheduled.
changes_scheduled_at
is in the past and addons[unit_price_in_decimal][i]
is not passed, then the addon’s current unit price is considered even if the addon did not exist on the date as of when the change is scheduled.
replace_addon_list
. (Addon trial periods must be enabled by Chargebee Support.)
pricing_model
other than flat_fee
.
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__KyVnHhSBWkfbN2Rf/change_term_end \ -u {site_api_key}:\ -d term_ends_at=1601490600
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkfbN2Rf/change_term_end \ -u {site_api_key}:\ -d term_ends_at=1601490600
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__KyVnHhSBWkrVS2Wn/reactivate \ -X POST \ -u {site_api_key}:\ -d invoice_immediately="true" \ -d billing_cycles=4
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkrVS2Wn/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__KyVnHhSBWkeIw2R1/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__KyVnHhSBWkeIw2R1/add_charge_at_term_end \ -u {site_api_key}:\ -d amount=300 \ -d description="Service Charge"
Adds a "non-recurring addon" charge to a 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 the charges for the non-recurring addon 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__KyVnHhSBWkfvE2Rn/charge_addon_at_term_end \ -u {site_api_key}:\ -d addon_id="non_recurring_addon" \ -d addon_quantity=3 \ -d addon_unit_price=100
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnHhSBWkfvE2Rn/charge_addon_at_term_end \ -u {site_api_key}:\ -d addon_id="non_recurring_addon" \ -d addon_quantity=3 \ -d addon_unit_price=100
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.
non_renewing
and cancelled
subscriptions.curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVkmQSCX2uew22/charge_future_renewals \ -u {site_api_key}:
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__KyVkmQSCX2wFs3l/remove_advance_invoice_schedule \ -X POST \ -u {site_api_key}:
curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVkmQSCX2wFs3l/remove_advance_invoice_schedule \ -X POST \ -u {site_api_key}:
Regenerates the invoice for the current term of the subscription. The subscription must have status
as active
or non_renewing
. This operation is not allowed when any of the following conditions hold true for the subscription:
status
is not voided
. Returns one of the following depending on the value of invoice_immediately
:
true
: an invoice
object that corresponds to the regenerated invoice. false
: a list of unbilled_charge
objects corresponding to all the unbilled charges created for the current term of the subscription. curl https://{site}.chargebee.com/api/v2/subscriptions/__test__KyVnOuSHufd0ih/regenerate_invoice \ -X POST \ -u {site_api_key}:\ -d invoice_immediately="true"
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.
curl https://{site}.chargebee.com/api/v2/subscriptions/import_subscription \ -u {site_api_key}:\ -d plan_id="no_trial" \ -d status="active" \ -d current_term_end=1602095400 \ -d customer[first_name]="John" \ -d customer[last_name]="Doe" \ -d customer[locale]="fr-CA" \ -d customer[phone]="+1-949-999-9999" \ -d billing_address[first_name]="John" \ -d billing_address[last_name]="Doe" \ -d billing_address[line1]="PO Box 9999" \ -d billing_address[city]="Walnut" \ -d billing_address[state]="California" \ -d billing_address[zip]="91789" \ -d billing_address[country]="US" \ -d billing_cycles=5 \ -d addons[id][0]="ssl" \ -d contract_term[action_at_term_end]="renew" \ -d contract_term_billing_cycle_on_renewal=3 \ -d contract_term[contract_start]=1509511210 \ -d contract_term[cancellation_cutoff_period]=3 \ -d contract_term[created_at]=1509511210 \ -d contract_term[total_amount_raised]="900" \ -d contract_term[billing_cycle]=5
curl https://{site}.chargebee.com/api/v2/subscriptions/import_subscription \ -u {site_api_key}:\ -d plan_id="no_trial" \ -d status="active" \ -d current_term_end=1602095400 \ -d customer[first_name]="John" \ -d customer[last_name]="Doe" \ -d customer[locale]="fr-CA" \ -d customer[phone]="+1-949-999-9999" \ -d billing_address[first_name]="John" \ -d billing_address[last_name]="Doe" \ -d billing_address[line1]="PO Box 9999" \ -d billing_address[city]="Walnut" \ -d billing_address[state]="California" \ -d billing_address[zip]="91789" \ -d billing_address[country]="US" \ -d billing_cycles=5 \ -d addons[id][0]="ssl" \ -d contract_term[action_at_term_end]="renew" \ -d contract_term_billing_cycle_on_renewal=3 \ -d contract_term[contract_start]=1509511210 \ -d contract_term[cancellation_cutoff_period]=3 \ -d contract_term[created_at]=1509511210 \ -d contract_term[total_amount_raised]="900" \ -d contract_term[billing_cycle]=5
billing_cycles
or a custom value depending on the site configuration.
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.
true
if you want an invoice to be created for the subscription.active
or non_renewing
status.current_term_start
to current_term_end
.hosted_page
should be created. When not provided, a new customer is created with the ID set to the value provided for subscription[id]
. If subscription[id]
is unavailable, then the customer ID is autogenerated.
entity_code
or exempt_number
attributes if you use Chargebee’s AvaTax for Sales or specify exemption_details
attribute if you use Chargebee’s AvaTax for Communications integration. Tax may still be applied by Avalara for certain values of entity_code
/exempt_number
/exemption_details
based on the state/region/province of the taxable address.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.
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
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.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.
check
payment_method
. This parameter should be passed only if the invoice is created for current term.
pricing_model
other than flat_fee
.
The price or per-unit-price of the addon. The value depends on the type of currency.
Note:
For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the addon period. For example, consider the following details:
unit_price
provided is $10period
. Provide the value as a decimal string in major units of the currency. Can be provided only when multi-decimal pricing is enabled.
pricing_model
other than flat_fee
.
curl https://{site}.chargebee.com/api/v2/customers/__test__KyVnHhSBWkp5t2VV/import_subscription \ -u {site_api_key}:\ -d plan_id="no_trial" \ -d status="in_trial" \ -d trial_end=1602095400 \ -d billing_cycles=5 \ -d addons[id][0]="ssl" \ -d contract_term[action_at_term_end]="renew" \ -d contract_term_billing_cycle_on_renewal=3 \ -d contract_term[contract_start]=1509511210 \ -d contract_term[cancellation_cutoff_period]=3 \ -d contract_term[created_at]=1509511210 \ -d contract_term[total_amount_raised]="900" \ -d contract_term[billing_cycle]=5
curl https://{site}.chargebee.com/api/v2/customers/__test__KyVnHhSBWkp5t2VV/import_subscription \ -u {site_api_key}:\ -d plan_id="no_trial" \ -d status="in_trial" \ -d trial_end=1602095400 \ -d billing_cycles=5 \ -d addons[id][0]="ssl" \ -d contract_term[action_at_term_end]="renew" \ -d contract_term_billing_cycle_on_renewal=3 \ -d contract_term[contract_start]=1509511210 \ -d contract_term[cancellation_cutoff_period]=3 \ -d contract_term[created_at]=1509511210 \ -d contract_term[total_amount_raised]="900" \ -d contract_term[billing_cycle]=5
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
.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.