Importing Orders
This endpoint can be used to import Order data to create and update Orders in a commercetools Project. The Order data to import is represented by OrderImport and loaded in OrderImportRequest, which is posted to import Orders.
To monitor an import status, use Get ImportSummary, Get ImportOperation, and Query ImportOperations.
Representations
OrderImportRequest
The request body to import Orders. Contains data for Orders to be created or updated in a commercetools Project.
typeString | "order"The order import resource type. |
resourcesArray 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.
orderNumberString | Maps to |
customer | |
customerEmailString | Maps to |
lineItemsArray of LineItemImportDraft | Maps to |
customLineItemsArray of CustomLineItemDraft | Maps to |
totalPrice | Maps to |
taxedPrice | Maps to |
shippingAddress | Maps to |
billingAddress | Maps to |
customerGroup | Maps to |
countryString | 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 |
itemShippingAddressesArray of Address | Maps to |
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 commercetools Project.
product | Maps to |
name | Maps to |
variantLineItemProductVariantImportDraft | Maps to |
priceLineItemPrice | Maps to |
quantityFloat | Maps to |
stateArray of ItemState | |
supplyChannel | Maps to |
distributionChannel | Maps to |
taxRateTaxRate | Maps to |
shippingDetailsItemShippingDetailsDraft | Maps to LineItem.shippingDetails. |
CustomLineItemDraft
name | |
money | |
taxedPriceCustomLineItemTaxedPrice | |
totalPrice | |
slugString | |
quantityFloat | |
stateArray of ItemState | |
taxCategory | References a tax category by key. |
taxRateTaxRate | |
externalTaxRateExternalTaxRateDraft | |
discountedPricePerQuantityArray of DiscountedLineItemPriceDraft | |
shippingDetailsItemShippingDetailsDraft |
TaxedPrice
totalNetMoney | Maps to |
totalGrossMoney | Maps to |
taxPortionsArray of TaxPortion | Maps to |
Address
idString | |
keyString | |
titleString | |
salutationString | |
firstNameString | |
lastNameString | |
streetNameString | |
streetNumberString | |
additionalStreetInfoString | |
postalCodeString | |
cityString | |
regionString | |
stateString | |
countryCountryCode | A two-digit country code as per ISO 3166-1 alpha-2. |
companyString | |
departmentString | |
buildingString | |
apartmentString | |
pOBoxString | |
phoneString | |
mobileString | |
emailString | |
faxString | |
additionalAddressInfoString | |
externalIdString |
OrderState
Maps to Order.orderState.
OpenConfirmedCompleteCancelled
ShipmentState
Maps to Order.shipmentState.
ShippedReadyPendingDelayedPartialBackorder
PaymentState
Maps to Order.paymentState.
BalanceDueFailedPendingCreditOwedPaid
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.
shippingMethodNameString | |
price | |
shippingRateShippingRateDraft | |
taxRateTaxRate | |
taxCategory | References a tax category by key. |
shippingMethod | References a shipping method by key. |
deliveriesArray of Delivery | Note that you can not add a |
discountedPriceDiscountedLineItemPriceDraft | |
shippingMethodStateShippingMethodState |
InventoryMode
Maps to Order.inventoryMode.
TrackOnlyReserveOnOrder
RoundingMode
Maps to Order.taxRoundingMode.
HalfEvenHalfUpHalfDown
TaxCalculationMode
Maps to Order.taxCalculationMode.
LineItemLevelUnitPriceLevel
CartOrigin
Maps to Order.origin.
CustomerMerchant
Import Orders
Creates a request for creating new Orders or updating existing ones.
manage_orders:{projectKey}regionString | The Region in which the Project is hosted. |
projectKeyString | The commercetools Project key. |
importContainerKeyString | The ImportContainer used to create the new resource |
curl -X POST 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