Using AI coding agents like Claude Code or Cursor? Try the official Chargebee Agent Skills to speed up your development.Try now
ChargebeeAPI

Import an order

Idempotency Supported

Import an order for an invoice with one or more line items. The import order bulk operation is to be applied on an imported invoice.

Sample Request

Sample Result[JSON]

URL Format

POST https://[site].chargebee.com/api/v2/orders/import_order

Input Parameters

id
optional, string, max chars=40

Uniquely identifies the order. It is the api identifier for the order.

*Order id will always be assigned incrementally from the last generated Order ID.

If Orders imported has an Order ID which is a string, Chargebee will just validate if the Order ID is unique

Recommendation: For orders being imported, set the same prefix and the serial number that is used for the Document number, which will make this into a string. This will ensure that imported orders don't conflict with orders created by Chargebee. Chargebee will ensure there aren't orders with duplicate Order IDs.* .

document_number
optional, string, max chars=50

The order's serial number.

Document number passed cannot be greater than the series mentioned in the configuration. For instance, if you have set Document number series in Order Configurations with a Prefix as 'ORDER' and Starting number as '1000', orders up to the sequence number 'ORDER999' can be imported into Chargebee

Recommendation: Set a different prefix at the Order Configuration, than the ones that are imported. If your Order Configuration has a Prefix of 'NEW', with Starting number as '1', i.e. 'NEW1', then, set Prefix for imported orders to be as 'OLD', with Starting number as '1', i.e, 'OLD1' .

invoice_id
required, string, max chars=50

The invoice number which acts as an identifier for invoice and is generated sequentially.

status
required, enumerated string

The status of this order.

Enum Values
cancelled

Order has been cancelled. Applicable only if you are using Chargebee's legacy order management system

queued

Order is yet to be processed by any system, these are scheduled orders created by Chargebee

awaiting_shipment

The order has been picked up by an integration system, and synced to a shipping management platform

on_hold

The order is paused from being processed.

delivered

The order has been delivered to the customer.

shipped

The order has moved from order management system to a shipping system.

partially_delivered

The order has been partially delivered to the customer.

returned

The order has been returned after delivery.

subscription_id
optional, string, max chars=50

The subscription for which the order is created.

customer_id
optional, string, max chars=50

The customer for which the order is created.

created_at
required, timestamp(UTC) in seconds

The time at which the order was created.

order_date
required, timestamp(UTC) in seconds

The date on which the order will start getting processed.

shipping_date
required, timestamp(UTC) in seconds

This is the date on which the order has to be shipped to the customer.

reference_id
optional, string, max chars=50

Reference id can be used to map the orders in the shipping/order management application to the orders in ChargeBee. The reference_id generally is the same as the order id in the third party application.

Recommendation:
If this order is in any of these statuses, awaiting_shipment, on_hold, delivered, shipped, partially_delivered, returned, and has already been processed, through a 3rd party system, and you have a reference id of the entity in the 3rd party tool, pass in the entity id to this field. If not, set the same prefix and the serial number that is used for the Document number, which will make this into a string.

If this order hasn't been processed and is in 'queued' status, do not pass any value to this field. Chargebee, when it syncs your Orders through the fulfilment integrations such as Shipstation or Shopify, would auto assign the reference id from the connected system. .

fulfillment_status
optional, string, max chars=50

The fulfillment status of an order as reflected in the shipping/order management application. Typical statuses include Shipped,Awaiting Shipment,Not fulfilled etc;.

*If this order is in any of these statuses, awaiting_shipment, on_hold, delivered, shipped, partially_delivered, returned, and has already been processed, through a 3rd party system, and you have a corresponding status from the 3rd party tool, pass in the status to this field.

If this order hasn't been processed and is in 'queued' status, do not pass any value to this field. Chargebee, when it syncs your Orders through the fulfilment integrations such as Shipstation or Shopify, would auto assign the fulfilment status from the connected system.* .

note
optional, string, max chars=600

The custom note for the order.

tracking_id
optional, string, max chars=50

The tracking id of the order.

tracking_url
optional, string, max chars=255

The tracking url of the order.

batch_id
optional, string, max chars=50

Unique id to identify a group of orders.

shipment_carrier
optional, string, max chars=50

Shipment carrier.

shipping_cut_off_date
optional, timestamp(UTC) in seconds

The time after which an order becomes unservicable.

delivered_at
optional, timestamp(UTC) in seconds

The time at which the order was delivered.

shipped_at
optional, timestamp(UTC) in seconds

The time at which the order was shipped.

cancelled_at
optional, timestamp(UTC) in seconds

The time at which the order was cancelled.

cancellation_reason
optional, enumerated string

Cancellation reason.

Enum Values
shipping_cut_off_passed

The invoice has been paid late and Chargebee cancel's the first order for the invoice.

product_unsatisfactory

Product unsatisfactory.

third_party_cancellation

Third party cancellation.

product_not_required

Product not required.

delivery_date_missed

Delivery date missed.

refundable_credits_issued
optional, in cents, min=0

If there are any credits that were issued at the order level, you can make use of the field, refundable_credits_issued. This will lead to Chargebee creating a Refundable Credit note against the order. When the next invoice is raised against the customer, this credit note will be utilised.

shipping_address
Parameters for shipping_address
pass parameters as shipping_address[<param name>]
billing_address
Parameters for billing_address
pass parameters as billing_address[<param name>]

Returns

Order object
Resource object representing order