Introducing the Better Auth Chargebee plugin: Use it to handle subscriptions, billing, and auth seamlessly.
Chargebeechargebee API

Import invoice

Idempotency Supported

Imports an invoice into Chargebee Billing. This endpoint allows you to import an invoice from external systems, such as accounting software, into Chargebee.

Sample Request

Sample Result[JSON]

URL Format

POST https://[site].chargebee.com/api/v2/invoices/import_invoice

Input Parameters

id
required, string, max chars=50

Invoice Number.

currency_code
required if Multicurrency is enabled, string, max chars=3

The currency code (ISO 4217 format) for the invoice.

customer_id
optional, string, max chars=50

Identifier of the customer for which this invoice needs to be created.

subscription_id
optional, string, max chars=50

If recurring items are present in line items then subscription id is required.

po_number
optional, string, max chars=100

Purchase Order Number for this invoice.

price_type
optional, enumerated string, default=tax_exclusive

The price type of the invoice.

Enum Values
tax_exclusive

All amounts in the document are exclusive of tax.

tax_inclusive

All amounts in the document are inclusive of tax.

tax_override_reason
optional, enumerated string

The reason for exempting the invoice from tax. (Applicable only for exempted invoices.).

Enum Values
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.)

customer_exempt

The customer is exempted from tax.

export

The customer is from a non-taxable region or the billing address and shipping address are unavailable.

vat_number
optional, string, max chars=20

Vat Number. Required if this invoice is VAT exempted.

vat_number_prefix
optional, string, max chars=10

An overridden value for the first two characters of the full VAT number. Only applicable specifically for customers with billing_address

country as XI (which is United Kingdom - Northern Ireland ).

When you have enabled EU VAT in 2021 or have manually enabled the Brexit configuration, you have the option of setting 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.

date
required, timestamp(UTC) in seconds

Date when invoice raised.

total
required, in cents, min=0

Invoice total amount.

round_off
optional, in cents, min=-99, max=99

Round off amount.

status
optional, enumerated string

Current status of this invoice.

Enum Values
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

payment_due

Indicates the payment is not yet collected and is being retried as per retry settings.

not_paid

Indicates the payment is not made and all attempts to collect is failed.

voided

Indicates a voided invoice.

pending

The invoice is yet to be closed (sent for payment collection). An invoice is generated with this status when it has line items that belong to items that are metered or when the subscription.create_pending_invoicesattribute is set to true. The invoice is yet to be closed (sent for payment collection). All invoices are generated with this status when Metered Billing is enabled for the site.

voided_at
optional, timestamp(UTC) in seconds

Timestamp indicating the date & time this invoice got voided.

void_reason_code
optional, string, max chars=100

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.

is_written_off
optional, boolean, default=false

If is_written_off is true then the invoice is written off.

write_off_amount
optional, in cents, default=0, min=0

Amount written off against this invoice. If this value is not present then the due amount of the invoice will be written off.

write_off_date
optional, timestamp(UTC) in seconds

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.

due_date
optional, timestamp(UTC) in seconds

Invoice Due Date.

net_term_days
optional, integer, default=0

Invoice net term days.

has_advance_charges
optional, boolean, default=false

Boolean indicating any advance charge is present in this invoice.

use_for_proration
optional, boolean, default=false

If the invoice falls within the subscription current term will be used for proration.

credit_note
Parameters for credit_note
pass parameters as credit_note[<param name>]
billing_address
Parameters for billing_address
pass parameters as billing_address[<param name>]
shipping_address
Parameters for shipping_address
pass parameters as shipping_address[<param name>]
line_items[0..n]
Parameters for line_items. Multiple line_items can be passed by specifying unique indices.
pass parameters as line_items[<param name>][<idx:0..n>]
payment_reference_numbers[0..n]
Parameters for payment_reference_numbers. Multiple payment_reference_numbers can be passed by specifying unique indices.
pass parameters as payment_reference_numbers[<param name>][<idx:0..n>]
line_item_tiers[0..n]
Parameters for line_item_tiers. Multiple line_item_tiers can be passed by specifying unique indices.
pass parameters as line_item_tiers[<param name>][<idx:0..n>]
discounts[0..n]
Parameters for discounts. Multiple discounts can be passed by specifying unique indices.
pass parameters as discounts[<param name>][<idx:0..n>]
taxes[0..n]
Parameters for taxes. Multiple taxes can be passed by specifying unique indices.
pass parameters as taxes[<param name>][<idx:0..n>]
payments[0..n]
Parameters for payments. Multiple payments can be passed by specifying unique indices.
pass parameters as payments[<param name>][<idx:0..n>]
notes[0..n]
Parameters for notes. Multiple notes can be passed by specifying unique indices.
pass parameters as notes[<param name>][<idx:0..n>]
line_item_addresses[0..n]
Parameters for line_item_addresses. Multiple line_item_addresses can be passed by specifying unique indices.
pass parameters as line_item_addresses[<param name>][<idx:0..n>]

Returns

Invoice object
Resource object representing invoice
Credit note object
Resource object representing credit_note