POST /credit_notes/import_credit_note
Imports a credit note into Chargebee Billing. This endpoint allows you to import a credit note from external systems, such as accounting software, into Chargebee.
Use this operation during data migration or reconciliation to ensure historical credits are represented in the system. The credit note is linked to a reference invoice and can be allocated to other invoices or recorded as refunded to the customer.
Impacts
Credit Note
The credit note's billing_address, shipping_address, and vat_number are copied from the reference invoice.
Invoices
Reference invoice
- See Impact on reference invoice.
Other invoices
- If
allocations[]are provided, then for each allocated invoice:- the invoice's
amount_duedecreases by the allocated amount - the invoice
statuschanges topaidif theamount_duebecomes zero - an applied credit record is created to track the allocation.
- the invoice's
Transactions
If linked_refunds[] are provided, then for each refund provided, a transaction of type refund is created with status set to success.
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 Valid 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 Valid 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-request-origin-user is ignored. |
chargebee-event-email |
String | No |
skip only emails Valid values:
|
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
discounts |
Object | No |
Parameters for discounts. Used to specify discounts, coupons, or promotional credits applied to the credit note at the document level or item level. |
discounts.description[] |
Array | No |
Description for this deduction. |
discounts.entity_id[] |
Array | No |
The unique identifier of the coupon. Required if
Constraints
|
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 identifier of the line item that this deduction is for. This must match the Required if
Constraints
|
discounts.entity_type[] |
Array | Yes | |
reference_invoice_id |
String | Yes |
The unique identifier of the invoice against which this credit note is issued. The invoice must already exist in your Chargebee Billing site. |
currency_code |
String | No |
The currency code (ISO 4217 format) for the credit note. Required if
|
sub_total |
Integer | No |
The credit note sub-total (total before round-off, fractional correction, and taxes). |
status |
String | No |
The status of the credit note. Determines the current state of the credit note and how it can be used. Default value
The credits are yet to be used or have been partially used. Constraints
The entire credit note amount has been used (either allocated to invoices or refunded). Constraints
The credit note has been cancelled. Constraints
The credit note has been adjusted against an invoice. Constraints
Valid values:
|
voided_at |
Integer | No |
The timestamp indicating when this credit note was voided. Constraints
Default value
|
date |
Integer | Yes |
The date when the credit note was issued. Constraints
|
round_off_amount |
Integer | No |
The rounded-off amount for the credit note. For example, if the credit note amount is $99.99 and it is rounded off to $100.00, then $0.01 is the Constraints
|
create_reason_code |
String | Yes |
The reason code for creating the credit note.
|
total |
Integer | No |
The total amount of the credit note. Constraints
Default value: 0 |
allocations |
Object | No |
Parameters for credit allocations. Used to specify how the credit note amount is allocated to invoices. Required if
Constraints
|
allocations.allocated_at[] |
Array | Yes |
The timestamp when the allocation occurred. Constraints
Default value
|
allocations.invoice_id[] |
Array | Yes |
The unique identifier of the invoice to which this credit note amount is allocated. The invoice must already exist in Chargebee. |
allocations.allocated_amount[] |
Array | Yes |
The amount allocated from this credit note to the specified invoice. Constraints
|
id |
String | Yes |
The unique identifier for the credit note (credit note number).
|
customer_id |
String | No |
The unique identifier of the customer for whom the credit note is created. Required if
Constraints
|
line_items |
Object | No |
Parameters for line items. At least one line item is required. |
line_items.tax3_name[] |
Array | No |
Third tax name. Required if
Constraints
|
line_items.tax9_name[] |
Array | No |
Ninth tax name. Required if
Constraints
|
line_items.description[] |
Array | Yes |
Description for this line item |
line_items.tax6_name[] |
Array | No |
Sixth tax name. Required if
Constraints
|
line_items.tax2_amount[] |
Array | No |
Second tax amount. Required if
|
line_items.item_level_discount1_amount[] |
Array | No |
First item level discount amount |
line_items.tax1_amount[] |
Array | No |
First tax amount. Required if
|
line_items.tax3_amount[] |
Array | No |
Third tax amount. Required if
|
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 |
The unique identifier for this line item. |
line_items.tax4_amount[] |
Array | No |
Fourth tax amount. Required if
|
line_items.tax5_amount[] |
Array | No |
Fifth tax amount. Required if
|
line_items.tax6_amount[] |
Array | No |
Sixth tax amount. Required if
|
line_items.tax7_amount[] |
Array | No |
Seventh tax amount. Required if
|
line_items.amount_in_decimal[] |
Array | No |
The decimal representation of the amount for the |
line_items.tax2_name[] |
Array | No |
Second tax name. Required if
Constraints
|
line_items.reference_line_item_id[] |
Array | No |
The unique identifier of the line item from the reference invoice that this credit note line item reverses. Constraints
|
line_items.item_level_discount2_entity_id[] |
Array | No |
Second item level discount entity id |
line_items.subscription_id[] |
Array | No |
The unique identifier of the subscription this line item belongs to. Constraints
|
line_items.date_to[] |
Array | No |
End date of this line item. |
line_items.quantity[] |
Array | No |
The quantity of the line item. Required if
Constraints
|
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. Required if
|
line_items.tax5_name[] |
Array | No |
Fifth tax name. Required if
Constraints
|
line_items.tax8_amount[] |
Array | No |
Eighth tax amount. Required if
|
line_items.tax10_amount[] |
Array | No |
Tenth tax amount. Required if
|
line_items.entity_type[] |
Array | No | |
line_items.tax8_name[] |
Array | No |
Eighth tax name. Required if
Constraints
|
line_items.unit_amount[] |
Array | No |
The unit amount of the line item. Required if
Constraints
|
line_items.tax1_name[] |
Array | No |
First tax name. Required if
Constraints
|
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 |
The total amount of this line item. Required if
Constraints
|
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. Required if
Constraints
|
line_items.tax4_name[] |
Array | No |
Fourth tax name. Required if
Constraints
|
line_items.tax10_name[] |
Array | No |
Tenth tax name. Required if
Constraints
|
fractional_correction |
Integer | No |
Indicates the fractional correction amount. |
vat_number_prefix |
String | No |
An overridden value for the first two characters of the full VAT number.
Only applicable specifically for customers with
When you have enabled EU VAT
in 2021 or have manually enabled
the Brexit configuration, you have the option of setting
|
type |
String | Yes |
The credit note type. Determines how the credit note can be used. Learn more about credit note types. * refundable -Refundable credit note. * store -Store credit note. Constraints
Adjustment credit note. Valid values:
|
linked_refunds |
Object | No |
Parameters for linked refunds. Used to record refund transactions associated with this credit note. Required if
Constraints
|
linked_refunds.id[] |
Array | No | |
linked_refunds.reference_number[] |
Array | No |
Reference number for this refund. |
linked_refunds.amount[] |
Array | Yes |
The amount of this refund transaction. Constraints
|
linked_refunds.payment_method[] |
Array | Yes | |
linked_refunds.date[] |
Array | Yes |
The date when the refund occurred.
|
line_item_tiers |
Object | No |
Parameters for line item tiers. Used to specify tiered pricing details for line items with |
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 the unit range for this tier. Not applicable for the highest 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 |
The unique identifier of the line item this tier belongs to. |
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 within this tier range. |
taxes |
Object | No |
Parameters for document-level taxes. Used to specify tax information at the credit note level. Prerequisite
|
taxes.rate[] |
Array | Yes |
The rate of tax. Note
|
taxes.juris_name[] |
Array | No |
The name of the tax jurisdiction |
taxes.name[] |
Array | Yes |
The name of the tax applied. Constraints
|
taxes.description[] |
Array | No |
Description of tax |
taxes.amount[] |
Array | No |
The total tax amount for this credit note. Constraints
|
taxes.juris_code[] |
Array | No |
The tax jurisdiction code |
taxes.juris_type[] |
Array | No | |
subscription_id |
String | No |
The unique identifier of the subscription for which this credit note is created. Required if
Constraints
|
refunded_at |
Integer | No |
The timestamp when this credit note was fully used (refunded or allocated). This field is automatically set when the credit note |
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.