POST /customers/{customer-id}/import_for_items
Imports a subscription into Chargebee.
Servers
- {protocol}://{site}.{environment}:{port}/api/v2
- {protocol}://{site}-test.{environment}:{port}/api/v2
Path parameters
Name | Type | Required | Description |
---|---|---|---|
customer-id |
String | Yes |
Request headers
Name | Type | Required | Description |
---|---|---|---|
chargebee-request-origin-device |
String | No |
The device from which the customer has made the request |
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/x-www-form-urlencoded" |
chargebee-event-webhook |
String | No |
skip only webhooks Possible values:
|
chargebee-business-entity-id |
String | No |
If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
chargebee-event-actions |
String | No |
skip all actions to be done on the events Possible values:
|
chargebee-request-origin-user |
String | No |
The email address of your customer/user. Use this when the email address has only ASCII characters. |
chargebee-request-origin-ip |
String | No |
The IP address of the customer where the request originated |
chargebee-request-origin-user-encoded |
String | No |
The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header |
chargebee-event-email |
String | No |
skip only emails Possible values:
|
Request body fields
Name | Type | Required | Description |
---|---|---|---|
discounts |
Object | No |
Parameters for discounts |
discounts.apply_on[] |
Array | No | |
discounts.included_in_mrr[] |
Array | No |
The discount is included in MRR calculations for your site. This attribute is only applicable when |
discounts.period_unit[] |
Array | No | |
discounts.percentage[] |
Array | No |
The percentage of the original amount that should be deducted from it. |
discounts.period[] |
Array | No |
The duration of time for which the discount is attached to the subscription, in |
discounts.amount[] |
Array | No |
The value of the discount. The format of this value depends on the kind of currency. |
discounts.duration_type[] |
Array | Yes | |
discounts.item_price_id[] |
Array | No |
The id of the item price in the subscription to which the discount is to be applied. Relevant only when |
activated_at |
Integer | No |
The time at which the subscription was activated. A subscription is "activated" when its The following conditions must be satisfied when passing this parameter:
Note:This parameter should not be provided when passing |
create_current_term_invoice |
Boolean | No |
Set as
Default value: false |
invoice_notes |
String | No |
A customer-facing note added to all invoices associated with this subscription. This note is one among all the notes displayed on the invoice PDF. |
subscription_items |
Object | No |
Parameters for subscription_items |
subscription_items.charge_on_event[] |
Array | No | |
subscription_items.unit_price[] |
Array | No |
The price/per unit price of the item. When not provided, the value set for the item price is used. This is only applicable when the |
subscription_items.charge_once[] |
Array | No |
Indicates if the charge-item is to be charged only once or each time the |
subscription_items.unit_price_in_decimal[] |
Array | No |
When price overriding is enabled for the site, the price or per-unit price of the item can be set here. The value set for the item price is used by default. Provide the value as a decimal string in major units of the currency. Can be provided only when multi-decimal pricing is enabled. |
subscription_items.item_price_id[] |
Array | Yes |
The unique identifier of the item price. |
subscription_items.quantity[] |
Array | No |
The quantity of the item purchased |
subscription_items.quantity_in_decimal[] |
Array | No |
The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when multi-decimal pricing is enabled. |
subscription_items.service_period_days[] |
Array | No |
The service period of the item in days from the day of charge. |
subscription_items.trial_end[] |
Array | No |
The date/time when the trial period of the item ends. Applies to plan-items and----when enabled----addon-items as well. |
subscription_items.billing_cycles[] |
Array | No |
For the plan-item price: For addon-item prices: |
coupon_ids[] |
Array | No |
List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
id |
String | No |
A unique and immutable identifier for the subscription. If not provided, it is autogenerated. |
net_term_days |
Integer | No |
Defines Net D for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid.
|
start_date |
Integer | No |
The date/time at which the subscription is to start or has started. If not provided, the subscription starts immediately. |
current_term_start |
Integer | No |
Start of the current billing period of the subscription. This is required when the subscription |
auto_collection |
String | No |
Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. * on - Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available. * off - Automatic collection of charges will not be made for this subscription. Use this for offline payments. Possible values:
|
contract_term |
Object | No |
Parameters for contract_term |
contract_term.id |
String | No |
Id that uniquely identifies the contract term in the site. |
contract_term.contract_start |
Integer | No |
The start date of the contract term |
contract_term.total_amount_raised_before_tax |
Integer | No |
The amount raised for the contract term till the time of importing the subscription excluding tax. This amount is added to the total_contract_value_before_tax Default value: 0 |
contract_term.action_at_term_end |
String | No |
Action to be taken when the contract term completes. * evergreen - Contract term completes and the subscription renews. * renew -
Possible values:
Default value: "renew" |
contract_term.created_at |
Integer | No |
The date when the contract term was created. |
contract_term.total_amount_raised |
Integer | No |
The amount raised for the contract term till the time of importing the subscription. This amount is added to the total_contract_value Default value: 0 |
contract_term.cancellation_cutoff_period |
Integer | No |
The number of days before Default value: 0 |
contract_term.billing_cycle |
Integer | No |
The number of billing cycles of the subscription that the contract term is for. |
payment_source_id |
String | No |
Id of the payment source to be attached to this subscription. |
shipping_address |
Object | No |
Parameters for shipping_address |
shipping_address.first_name |
String | No |
The first name of the contact. |
shipping_address.state |
String | No |
The state/province name. Is set by Chargebee automatically for US, Canada and India If |
shipping_address.city |
String | No |
The name of the city. |
shipping_address.validation_status |
String | No |
The address verification status. * partially_valid - The address is valid for taxability but has not been validated for shipping. * invalid - Address is invalid. * not_validated - Address is not yet validated. * valid - Address was validated successfully. Possible values:
Default value: "not_validated" |
shipping_address.line2 |
String | No |
Address line 2 |
shipping_address.line1 |
String | No |
Address line 1 |
shipping_address.email |
String | No |
The email address. |
shipping_address.last_name |
String | No |
The last name of the contact. |
shipping_address.company |
String | No |
The company name. |
shipping_address.line3 |
String | No |
Address line 3 |
shipping_address.state_code |
String | No |
The ISO 3166-2 state/province code without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set |
shipping_address.zip |
String | No |
Zip or postal code. The number of characters is validated according to the rules specified here. |
shipping_address.phone |
String | No |
The phone number. |
shipping_address.country |
String | No |
The billing address country of the customer. Must be one of ISO 3166 alpha-2 country code. Note : If you enter an invalid country code, the system will return an error. Brexit If you have enabled EU VAT in 2021 or later, or have manually enable the Brexit configuration, then |
cancel_reason_code |
String | No |
Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in Settings > Configure Chargebee > Reason Codes > Subscriptions > Subscription Cancellation. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
current_term_end |
Integer | No |
End of the current billing term. Subscription is renewed immediately after this. If not given, this will be calculated based on plan billing cycle. Note: For subscription status: . |
pause_date |
Integer | No |
When a pause has been scheduled, it is the date/time of scheduled pause. When the subscription is in the |
po_number |
String | No |
Purchase order number for this subscription. |
meta_data |
Object | No |
A set of key-value pairs stored as additional information for the subscription. [Learn more](./#meta_data). |
exhausted_coupon_ids[] |
Array | No |
Specifies the IDs of to be marked as exhausted. This parameter accepts a list of IDs, which must correspond to coupons with a duration_type of |
status |
String | Yes |
Current state of the subscription. * future - The subscription is scheduled to start at a future date. * active - The subscription is active and will be charged for automatically based on the items in it. * cancelled - The subscription has been canceled and is no longer in service. * transferred - The subscription has been transferred to another business entity within the organization. * in_trial - The subscription is in trial. * non_renewing - The subscription will be canceled at the end of the current term. * paused - The subscription is paused. The subscription will not renew while in this state. Possible values:
|
auto_close_invoices |
Boolean | No |
Set to |
started_at |
Integer | No |
Time at which the subscription was started. Is |
billing_cycles |
Integer | No |
The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles set for the plan-item price is used. |
trial_start |
Integer | No |
Start of the trial period for the subscription. When not passed, it is assumed to be current time. When passed for a |
create_pending_invoices |
Boolean | No |
Indicates whether the invoices for this subscription are generated with a You can also set this to
Applicable only when Metered Billing is enabled for the site . |
transaction |
Object | No |
Parameters for transaction |
transaction.reference_number |
String | No |
The reference number for this transaction. For example, check number in case of |
transaction.amount |
Integer | No |
The payment transaction amount. This parameter should be passed only if the invoice is created for current term. |
transaction.payment_method |
String | No |
The payment method of this transaction. This parameter should be passed only if the invoice is created for current term. * cash - Cash * alipay - Alipay * sofort - Sofort * direct_debit - Direct Debit * netbanking_emandates - netbanking_emandates * klarna_pay_now - Klarna Pay Now * paypal_express_checkout - Paypal Express Checkout * automated_bank_transfer - Automated Bank Transfer * venmo - Venmo * bancontact - Bancontact * custom - Custom * upi - upi * unionpay - Unionpay * apple_pay - Apple Pay * wechat_pay - WeChat Pay * card - Card * boleto - boleto * pay_to - PayTo * ideal - IDEAL * check - Check * sepa_instant_transfer - Sepa Instant Transfer * sepa_credit - SEPA Credit * ach_credit - ACH Credit * faster_payments - Faster Payments * bank_transfer - Bank Transfer * chargeback - Only applicable for a transaction of type = Possible values:
|
transaction.date |
Integer | No |
The date of occurence of the transaction. This parameter should be passed only if the invoice is created for current term. |
item_tiers |
Object | No |
Parameters for item_tiers |
item_tiers.starting_unit_in_decimal[] |
Array | No |
The decimal representation of the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as |
item_tiers.price_in_decimal[] |
Array | No |
The decimal representation of the per-unit price for the tier when the |
item_tiers.package_size[] |
Array | No |
Package size for the tier when pricing type is |
item_tiers.price[] |
Array | No |
The overridden price of the tier. The value depends on the type of currency. |
item_tiers.ending_unit[] |
Array | No |
The highest value in the quantity tier. |
item_tiers.item_price_id[] |
Array | No |
The id of the item price for which the tier price is being overridden. |
item_tiers.pricing_type[] |
Array | No | |
item_tiers.starting_unit[] |
Array | No |
The lowest value in the quantity tier. |
item_tiers.ending_unit_in_decimal[] |
Array | No |
The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the |
cancelled_at |
Integer | No |
Time at which subscription was cancelled or is set to be cancelled. |
resume_date |
Integer | No |
For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned. |
trial_end |
Integer | No |
End of the trial period for the subscription. This overrides the trial period set for the plan-item. The value must be later than |
contract_term_billing_cycle_on_renewal |
Integer | No |
Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as |
charged_items |
Object | No |
Parameters for charged_items |
charged_items.last_charged_at[] |
Array | No |
Timestamp indicating when this charge item_price was last charged for this subscription. |
charged_items.item_price_id[] |
Array | No |
A unique ID for your system to identify the item price. |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.