Importing Orders
Create new Orders in your Project.
The Order data to import is represented by OrderImport and included in an OrderImportRequest, which is imported using Import Orders.
To update an Order's ReturnInfo, Parcel, and Delivery information, use OrderPatchImport.
Representations
OrderImportRequest
The request body to import Orders. Contains data for Orders to be created in a Project.
type | "order" The Order import resource type. |
resources Array of OrderImport | The order import resources of this request. MaxItems:20 |
{"type": "order","resources": [{"orderNumber": "test-order-number","customer": {"typeId": "customer","key": "order-customer-key"},"customerEmail": "customer-email@example.com","shippingInfo": {"shippingMethodName": "string-name","price": {"type": "centPrecision","currencyCode": "EUR","centAmount": 300},"shippingRate": {"price": {"type": "centPrecision","currencyCode": "EUR","centAmount": 3},"tiers": []},"deliveries": [{"id": "4ce24c27-cce5-447c-890e-0d6b70b690ba","createdAt": "2021-04-30T09:21:15.003Z","items": [{"id": "95a6e7a7-b74e-4397-b0b4-37473d2e3573","quantity": 4}],"parcels": [{"id": "98840afa-ac20-4a34-a904-88d3407e2d76","createdAt": "2021-04-30T09:21:15.003Z","measurements": {"heightInMillimeter": 20,"lengthInMillimeter": 40,"widthInMillimeter": 5,"weightInGram": 10}}]}]},"lineItems": [{"name": {"en": "abc"},"quantity": 10,"price": {"value": {"type": "centPrecision","centAmount": 100,"currencyCode": "EUR"}},"supplyChannel": {"typeId": "channel","key": "supplier-channel-key"},"variant": {"productVariant": {"typeId": "product-variant","key": "product-key"},"sku": "variant-sku","attributes": [],"images": [],"prices": []}}],"customLineItems": [{"name": {"en": "name"},"totalPrice": {"type": "centPrecision","centAmount": 123,"currencyCode": "EUR"},"state": [{"quantity": 10,"state": {"key": "state-key","typeId": "state"}}],"money": {"type": "centPrecision","centAmount": 123,"currencyCode": "EUR"},"quantity": 10,"slug": "my-slug","taxCategory": {"typeId": "tax-category","key": "tax-category-key"},"discountedPricePerQuantity": [{"value": {"type": "centPrecision","centAmount": 123,"currencyCode": "EUR"},"includedDiscounts": [{"discountedAmount": {"type": "centPrecision","centAmount": 123,"currencyCode": "EUR"},"discount": {"typeId": "cart-discount","key": "cart-discount-key"}}]}]}],"customerGroup": {"typeId": "customer-group","key": "customer-group-key"},"totalPrice": {"type": "centPrecision","currencyCode": "EUR","centAmount": 4200}}]}
OrderImport
The data representation for an Order to be imported that is persisted as an Order in the Project.
In commercetools, you can import an Order using the Create Order by Import endpoint method instead of creating it from a Cart.
An OrderImport is a snapshot of an order at the time it was imported.
orderNumber String | Maps to |
customer | |
customerEmail String | Maps to |
lineItems Array of LineItemImportDraft | Maps to |
customLineItems Array of CustomLineItemDraft | Maps to |
totalPrice | Maps to |
taxedPrice | Maps to |
shippingAddress | Maps to |
billingAddress | Maps to |
customerGroup | Maps to |
country String | Maps to |
orderState | Maps to |
shipmentState | Maps to |
paymentState | Maps to |
shippingInfo | Maps to |
completedAt | Maps to |
inventoryMode | Maps to |
taxRoundingMode | Maps to |
taxCalculationMode | Maps to |
origin | Maps to |
itemShippingAddresses Array of Address | Maps to |
store | Reference to the Store in which the Order is associated. If referenced Store does not exist, the |
state | Reference to a State in a custom workflow. |
custom | Maps to |
LineItemImportDraft
Represents an individual Line Item in an Order. A line item is a snapshot of a product at the time it was added to the order.
You cannot create an Order that includes line item operations that do not exist in the Project or have been deleted. Products and Product Variants referenced by a line item must already exist in the Project.
product | Maps to |
name | Maps to |
variant LineItemProductVariantImportDraft | Maps to |
price LineItemPrice | Maps to |
quantity Int | Maps to |
state Array of ItemState | |
supplyChannel | Maps to |
distributionChannel | Maps to |
taxRate TaxRate | Maps to |
shippingDetails ItemShippingDetailsDraft | Maps to LineItem.shippingDetails. |
custom | Custom Fields for this Line Item. |
CustomLineItemDraft
name | |
money | |
taxedPrice CustomLineItemTaxedPrice | |
totalPrice | |
slug String | |
quantity Int | |
state Array of ItemState | |
taxCategory | References a tax category by key. |
taxRate TaxRate | |
externalTaxRate ExternalTaxRateDraft | |
discountedPricePerQuantity Array of DiscountedLineItemPriceDraft | |
shippingDetails ItemShippingDetailsDraft |
TaxedPrice
totalNet Money | Maps to |
totalGross Money | Maps to |
taxPortions Array of TaxPortion | Maps to |
Address
id String | |
key String | |
externalId String | |
title String | |
salutation String | |
firstName String | |
lastName String | |
streetName String | |
streetNumber String | |
additionalStreetInfo String | |
postalCode String | |
city String | |
region String | |
state String | |
country | A two-digit country code as per ISO 3166-1 alpha-2. |
company String | |
department String | |
building String | |
apartment String | |
pOBox String | |
phone String | |
mobile String | |
email String | |
fax String | |
additionalAddressInfo String | |
custom | Custom Fields defined for the Address. Custom Fields can only be applied to |
OrderState
Maps to Order.orderState
.
Open
Confirmed
Complete
Cancelled
ShipmentState
Maps to Order.shipmentState
.
Shipped
Ready
Pending
Delayed
Partial
Backorder
PaymentState
Maps to Order.paymentState
.
BalanceDue
Failed
Pending
CreditOwed
Paid
ShippingInfoImportDraft
Maps to an order's shippingInfo
property. This field is usually populated by the cart assosciated with
the order, but when importing orders you must provide a draft representation as a part of the OrderImport.
shippingMethodName String | |
price | |
shippingRate ShippingRateDraft | |
taxRate TaxRate | |
taxCategory | References a tax category by key. |
shippingMethod | References a shipping method by key. |
deliveries Array of Delivery | Note that you can not add a |
discountedPrice DiscountedLineItemPriceDraft | |
shippingMethodState ShippingMethodState |
InventoryMode
Maps to Order.inventoryMode
.
TrackOnly
ReserveOnOrder
RoundingMode
Maps to Order.taxRoundingMode
.
HalfEven
HalfUp
HalfDown
TaxCalculationMode
Maps to Order.taxCalculationMode
.
LineItemLevel
UnitPriceLevel
CartOrigin
Maps to Order.origin
.
Customer
Merchant
Delivery
id String | |
items Array of DeliveryItem | |
parcels Array of Parcel | |
address | |
createdAt |
Parcel
id String | |
measurements | |
trackingData | |
items Array of DeliveryItem | |
custom | |
createdAt |
Import Orders
Creates a request for creating new Orders.
manage_orders:{projectKey}
region String | The Region in which the Project is hosted. |
projectKey String | The Project key. |
importContainerKey String | The ImportContainer used to create the new resource |
application/json
application/json
curl https://import.{region}.commercetools.com/{projectKey}/orders/import-containers/{importContainerKey} -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"type" : "order","resources" : [ {"orderNumber" : "test-order-number","customer" : {"typeId" : "customer","key" : "order-customer-key"},"customerEmail" : "customer-email@example.com","shippingInfo" : {"shippingMethodName" : "string-name","price" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 300},"shippingRate" : {"price" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 3},"tiers" : [ ]},"deliveries" : [ {"id" : "4ce24c27-cce5-447c-890e-0d6b70b690ba","createdAt" : "2021-04-30T09:21:15.003Z","items" : [ {"id" : "95a6e7a7-b74e-4397-b0b4-37473d2e3573","quantity" : 4} ],"parcels" : [ {"id" : "98840afa-ac20-4a34-a904-88d3407e2d76","createdAt" : "2021-04-30T09:21:15.003Z","measurements" : {"heightInMillimeter" : 20,"lengthInMillimeter" : 40,"widthInMillimeter" : 5,"weightInGram" : 10}} ]} ]},"lineItems" : [ {"name" : {"en" : "abc"},"quantity" : 10,"price" : {"value" : {"type" : "centPrecision","centAmount" : 100,"currencyCode" : "EUR"}},"supplyChannel" : {"typeId" : "channel","key" : "supplier-channel-key"},"variant" : {"productVariant" : {"typeId" : "product-variant","key" : "product-key"},"sku" : "variant-sku","attributes" : [ ],"images" : [ ],"prices" : [ ]}} ],"customLineItems" : [ {"name" : {"en" : "name"},"totalPrice" : {"type" : "centPrecision","centAmount" : 123,"currencyCode" : "EUR"},"state" : [ {"quantity" : 10,"state" : {"key" : "state-key","typeId" : "state"}} ],"money" : {"type" : "centPrecision","centAmount" : 123,"currencyCode" : "EUR"},"quantity" : 10,"slug" : "my-slug","taxCategory" : {"typeId" : "tax-category","key" : "tax-category-key"},"discountedPricePerQuantity" : [ {"value" : {"type" : "centPrecision","centAmount" : 123,"currencyCode" : "EUR"},"includedDiscounts" : [ {"discountedAmount" : {"type" : "centPrecision","centAmount" : 123,"currencyCode" : "EUR"},"discount" : {"typeId" : "cart-discount","key" : "cart-discount-key"}} ]} ]} ],"customerGroup" : {"typeId" : "customer-group","key" : "customer-group-key"},"totalPrice" : {"type" : "centPrecision","currencyCode" : "EUR","centAmount" : 4200}} ]}DATA