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. |
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 |
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 |
variantLineItemProductVariantImportDraft | Maps to |
priceLineItemPrice | Maps to |
quantityInt | Maps to |
stateArray of ItemState | |
supplyChannel | Maps to |
distributionChannel | Maps to |
taxRateTaxRate | Maps to |
shippingDetailsItemShippingDetailsDraft | Maps to LineItem.shippingDetails. |
custom | Custom Fields for this Line Item. |
CustomLineItemDraft
name | |
money | |
taxedPriceCustomLineItemTaxedPrice | |
totalPrice | |
slugString | |
quantityInt | |
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 | |
externalIdString | |
titleString | |
salutationString | |
firstNameString | |
lastNameString | |
streetNameString | |
streetNumberString | |
additionalStreetInfoString | |
postalCodeString | |
cityString | |
regionString | |
stateString | |
country | A two-digit country code as per ISO 3166-1 alpha-2. |
companyString | |
departmentString | |
buildingString | |
apartmentString | |
pOBoxString | |
phoneString | |
mobileString | |
emailString | |
faxString | |
additionalAddressInfoString | |
custom | Custom Fields defined for the Address. Custom Fields can only be applied to |
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 associated 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
Delivery
idString | |
itemsArray of DeliveryItem | |
parcelsArray of Parcel | |
address | |
createdAt |
Parcel
idString | |
measurements | |
trackingData | |
itemsArray of DeliveryItem | |
custom | |
createdAt |
Import Orders
Creates a request for creating new Orders.
manage_orders:{projectKey}regionString | The Region in which the Project is hosted. |
projectKeyString | The Project key. |
importContainerKeyString | The ImportContainer used to create the new resource |
application/jsonapplication/jsoncurl 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