POST /invoices/import_invoice
Imports an invoice into Chargebee Billing. This endpoint allows you to import an invoice from external systems, such as accounting software, into Chargebee.
Caution: Importing Current-Term Invoices
To ensure accurate proration for any changes to the subscription in the current term, only import one current term invoice. Chargebee considers only the first imported invoice for the current term when calculating proration. If there are multiple invoices for the current term in the source system, consolidate them into a single invoice before importing it into Chargebee.
Servers
- {protocol}://{site}.{environment}:{port}/api/v2
- {protocol}://{site}-test.{environment}:{port}/api/v2
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.description[] |
Array | No |
Description for this deduction. |
discounts.entity_id[] |
Array | No |
When the deduction is due to a |
discounts.amount[] |
Array | Yes |
The amount deducted. The format of this value depends on the kind of currency. |
discounts.line_item_id[] |
Array | No |
The unique id of the line item that this deduction is for. Is required when |
discounts.entity_type[] |
Array | Yes | |
credit_note |
Object | No |
Parameters for credit_note |
credit_note.id |
String | No |
A unique identifier for the credit note. This is a mandatory field if is_written_off is true. |
currency_code |
String | No |
The currency code (ISO 4217 format) for the invoice. |
payments |
Object | No |
Parameters for payments |
payments.reference_number[] |
Array | No |
Reference number for this payment |
payments.amount[] |
Array | Yes |
Payment made for this invoice |
payments.payment_method[] |
Array | Yes | |
payments.date[] |
Array | No |
Payment date |
voided_at |
Integer | No |
Timestamp indicating the date & time this invoice got voided. |
round_off |
Integer | No |
Round off amount. |
use_for_proration |
Boolean | No |
If the invoice falls within the subscription current term will be used for proration. Default value: false |
vat_number |
String | No |
Vat Number. Required if this invoice is VAT exempted. |
date |
Integer | Yes |
Date when invoice raised. |
payment_reference_numbers |
Object | No |
Parameters for payment_reference_numbers |
payment_reference_numbers.id[] |
Array | No |
If |
payment_reference_numbers.number[] |
Array | Yes |
If you have already generated a |
payment_reference_numbers.type[] |
Array | Yes | |
line_item_addresses |
Object | No |
The list of addresses used for tax calculation on line items. |
line_item_addresses.first_name[] |
Array | No |
First name of the customer |
line_item_addresses.state[] |
Array | No |
State or Province |
line_item_addresses.line_item_id[] |
Array | No |
Line item reference |
line_item_addresses.city[] |
Array | No |
Name of the city |
line_item_addresses.validation_status[] |
Array | No | |
line_item_addresses.line2[] |
Array | No |
Address line 2 |
line_item_addresses.line1[] |
Array | No |
Address line 1 |
line_item_addresses.email[] |
Array | No |
Email address of the customer |
line_item_addresses.last_name[] |
Array | No |
Last name of the customer |
line_item_addresses.company[] |
Array | No |
Name of the company |
line_item_addresses.line3[] |
Array | No |
Address line 3 |
line_item_addresses.state_code[] |
Array | 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 |
line_item_addresses.zip[] |
Array | No |
Zip or postal code. The number of characters is validated according to the rules specified here. |
line_item_addresses.phone[] |
Array | No |
Phone number of the customer |
line_item_addresses.country[] |
Array | No |
The billing address of the customer, specified as an ISO 3166 alpha-2 code. Entering an invalid code will return an error. If EU VAT (2021 or later) or Brexit configuration is enabled, 'United Kingdom---Northern Ireland' is a valid option. |
id |
String | Yes |
Invoice Number. |
net_term_days |
Integer | No |
Invoice net term days. Default value: 0 |
line_items |
Object | No |
Parameters for line_items |
line_items.tax3_name[] |
Array | No |
Third tax name |
line_items.tax9_name[] |
Array | No |
Ninth tax name |
line_items.description[] |
Array | Yes |
Description for this line item |
line_items.tax6_name[] |
Array | No |
Sixth tax name |
line_items.tax2_amount[] |
Array | No |
Second tax amount |
line_items.item_level_discount1_amount[] |
Array | No |
First item level discount amount |
line_items.tax1_amount[] |
Array | No |
First tax amount |
line_items.tax3_amount[] |
Array | No |
Third tax amount |
line_items.unit_amount_in_decimal[] |
Array | No |
The decimal representation of the unit amount of the |
line_items.item_level_discount2_amount[] |
Array | No |
Second item level discount amount |
line_items.id[] |
Array | No |
Uniquely identifies a line_item |
line_items.tax4_amount[] |
Array | No |
Fourth tax amount |
line_items.tax5_amount[] |
Array | No |
Fifth tax amount |
line_items.tax6_amount[] |
Array | No |
Sixth tax amount |
line_items.tax7_amount[] |
Array | No |
Seventh tax amount |
line_items.amount_in_decimal[] |
Array | No |
The decimal representation of the amount for the |
line_items.tax2_name[] |
Array | No |
Second tax name |
line_items.item_level_discount2_entity_id[] |
Array | No |
Second item level discount entity id |
line_items.subscription_id[] |
Array | No |
A unique identifier for the subscription this line item belongs to. |
line_items.date_to[] |
Array | No |
End date of this line item. |
line_items.quantity[] |
Array | No |
Quantity of the recurring item which is represented by this line item. For |
line_items.quantity_in_decimal[] |
Array | No |
The decimal representation of the quantity of this line_item. Returned when the |
line_items.tax9_amount[] |
Array | No |
Ninth tax amount |
line_items.tax5_name[] |
Array | No |
Fifth tax name |
line_items.tax8_amount[] |
Array | No |
Eighth tax amount |
line_items.tax10_amount[] |
Array | No |
Tenth tax amount |
line_items.entity_type[] |
Array | No | |
line_items.tax8_name[] |
Array | No |
Eighth tax name |
line_items.unit_amount[] |
Array | No |
Unit amount of the line item. |
line_items.tax1_name[] |
Array | No |
First tax name |
line_items.item_level_discount1_entity_id[] |
Array | No |
First item level discount entity id |
line_items.date_from[] |
Array | No |
Start date of this line item. |
line_items.amount[] |
Array | No |
Total amount of this lineitem. Not required if the line_items[unit_amount] param is passed |
line_items.entity_id[] |
Array | No |
The identifier of the modelled entity this line item is based on. Will be null for 'adhoc' entity type |
line_items.tax7_name[] |
Array | No |
Seventh tax name |
line_items.tax4_name[] |
Array | No |
Fourth tax name |
line_items.created_at[] |
Array | No | |
line_items.tax10_name[] |
Array | No |
Tenth tax name |
void_reason_code |
String | No |
Reason code for voiding the invoice. Select from a list of reason codes set in the Chargebee app in Settings > Configure Chargebee > Reason Codes > Invoices > Void invoice. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
tax_override_reason |
String | No |
The reason for exempting the invoice from tax. (Applicable only for exempted invoices.). * export - The customer is from a non-taxable region or the billing address and shipping address are unavailable. * customer_exempt - The customer is exempted from tax. * id_exempt - The customer is from a different country than your business and they have a valid VAT number or, the customer is a business entity. (This reason is only applicable when EU VAT or UK VAT is enabled.) Possible values:
|
taxes |
Object | No |
Parameters for taxes |
taxes.rate[] |
Array | Yes |
The rate of tax used to calculate tax amount |
taxes.juris_name[] |
Array | No |
The name of the tax jurisdiction |
taxes.name[] |
Array | Yes |
The name of the tax applied |
taxes.description[] |
Array | No |
Description of tax |
taxes.amount[] |
Array | No |
Total tax amount charged for this invoice |
taxes.juris_code[] |
Array | No |
The tax jurisdiction code |
taxes.juris_type[] |
Array | No | |
subscription_id |
String | No |
If recurring items are present in line items then subscription id is required. |
billing_address |
Object | No |
Parameters for billing_address |
billing_address.first_name |
String | No |
The first name of the billing contact. |
billing_address.state |
String | No |
The state/province name. Is set by Chargebee automatically for US, Canada and India If |
billing_address.city |
String | No |
The name of the city. |
billing_address.validation_status |
String | No |
The address verification status. * valid - Address was validated successfully. * 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. Possible values:
Default value: "not_validated" |
billing_address.line2 |
String | No |
Address line 2 |
billing_address.line1 |
String | No |
Address line 1 |
billing_address.email |
String | No |
The email address. |
billing_address.last_name |
String | No |
The last name of the billing contact. |
billing_address.company |
String | No |
The company name. |
billing_address.line3 |
String | No |
Address line 3 |
billing_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 |
billing_address.zip |
String | No |
Zip or postal code. The number of characters is validated according to the rules specified here. |
billing_address.phone |
String | No |
The phone number. |
billing_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 |
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. * not_validated - Address is not yet validated. * valid - Address was validated successfully. * partially_valid - The address is valid for taxability but has not been validated for shipping. * invalid - Address is invalid. 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 |
is_written_off |
Boolean | No |
If is_written_off is true then the invoice is written off. Default value: false |
has_advance_charges |
Boolean | No |
Boolean indicating any advance charge is present in this invoice. Default value: false |
po_number |
String | No |
Purchase Order Number for this invoice. |
status |
String | No |
Current status of this invoice. * not_paid - Indicates the payment is not made and all attempts to collect is failed. * voided - Indicates a voided invoice. * paid - Indicates a paid invoice. * posted - Indicates the payment is not yet collected and will be in this state till the due date to indicate the due period * pending - Possible values:
|
price_type |
String | No |
The price type of the invoice. * tax_inclusive - All amounts in the document are inclusive of tax. * tax_exclusive - All amounts in the document are exclusive of tax. Possible values:
Default value: "tax_exclusive" |
total |
Integer | Yes |
Invoice total amount. |
write_off_amount |
Integer | No |
Amount written off against this invoice. If this value is not present then the due amount of the invoice will be written off. Default value: 0 |
customer_id |
String | No |
Identifier of the customer for which this invoice needs to be created. |
notes |
Object | No |
Parameters for notes |
notes.note[] |
Array | No |
Actual note. |
notes.entity_id[] |
Array | No |
Id of the mentioned entity type |
notes.entity_type[] |
Array | No | |
vat_number_prefix |
String | No |
An overridden value for the first two characters of the full VAT
number. Only applicable specifically for customers with billing_address When you have enabled EU VAT in 2021 or have manually
enabled the Brexit configuration, you have the option of setting billing_address |
write_off_date |
Integer | No |
The date on which the write_off invoice has occurred. This is a mandatory field if is_written_off is true. The same date reflects on the created credit note. |
line_item_tiers |
Object | No |
Parameters for line_item_tiers |
line_item_tiers.unit_amount[] |
Array | No |
The price of the tier if the charge model is a |
line_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 |
line_item_tiers.ending_unit[] |
Array | No |
The upper limit of a range of units for the tier |
line_item_tiers.quantity_used_in_decimal[] |
Array | No |
The decimal representation of the quantity purchased from this tier. Returned when the |
line_item_tiers.line_item_id[] |
Array | Yes |
Uniquely identifies a line_item |
line_item_tiers.starting_unit[] |
Array | No |
The lower limit of a range of units for the tier |
line_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 |
line_item_tiers.unit_amount_in_decimal[] |
Array | No |
The decimal representation of the per-unit price for the tier when the |
line_item_tiers.quantity_used[] |
Array | No |
The number of units purchased in a range. |
due_date |
Integer | No |
Invoice Due Date. |
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.