Orders Import

Orders can also be imported via the Import API endpoint so you don't have to create a cart before.

Representations

OrderImportDraft

An order import draft is a snapshot of an order at the time it was imported.

  • orderNumber - String - Optional
    String that unique identifies an order. It can be used to create more human-readable (in contrast to ID) identifier for the order. It should be unique within a project.
  • customerId - String - Optional
    If given the customer with that ID must exist in the project.
  • customerEmail - String - Optional
    The customer email can be used when no check against existing Customers is desired during order import.
  • lineItems - Array of LineItemImportDraft - Optional
    If not given customLineItems must not be empty.
  • customLineItems - Array of CustomLineItem - Optional
    If not given lineItems must not be empty.
  • totalPrice - Money - Required
  • taxedPrice - TaxedPrice - Optional
    Order Import does not support calculation of taxes. When setting the draft the taxedPrice is to be provided.
  • shippingAddress - Address - Optional
  • billingAddress - Address - Optional
  • customerGroup - Reference to a CustomerGroup - Optional
    Set when the customer is set and the customer is a member of a customer group. Used for product variant price selection.
  • country - String - Optional
    A two-digit country code as per ↗ ISO 3166-1 alpha-2 . Used for product variant price selection.
  • orderState - OrderState - Optional
    If not given the Open state will be assigned by default.
  • shipmentState - ShipmentState - Optional
  • paymentState - PaymentState - Optional
  • shippingInfo - ShippingInfo - Optional
    Set if the ShippingMethod is set.
  • completedAt - DateTime - Optional
  • custom - CustomFieldsDraft - Optional
    The custom fields.
  • inventoryMode - InventoryMode - Optional
    If not given the mode None will be assigned by default.
  • taxRoundingMode - RoundingMode - Optional
    If not given the tax rounding mode HalfEven will be assigned by default.
  • taxCalculationMode - TaxCalculationMode - Optional
    The default tax calculation mode is LineItemLevel.
  • origin - CartOrigin - Optional
    The default origin is Customer.
  • itemShippingAddresses - Array of Address - Optional
    Contains addresses for orders with multiple shipping addresses.

LineItemImportDraft

A line item import draft is a snapshot of a product variant at the time it was imported with the order.

ProductVariantImportDraft

  • id - Number - Optional
    The sequential ID of the variant within the product. The variant with provided ID should exist in some existing product, so you also need to specify the productId if this property is set, or alternatively you can just specify SKU of the product variant.
  • sku - String - Optional The SKU of the existing variant.
  • prices - Array of Price - Optional
    The prices of the variant. The prices should not contain two prices for the same price scope (same currency, country and customer group). If this property is defined, then it will override the prices property from the original product variant, otherwise prices property from the original product variant would be copied in the resulting order.
  • attributes - Array of Attribute - Optional
    If this property is defined, then it will override the attributes property from the original product variant, otherwise attributes property from the original product variant would be copied in the resulting order.
  • images - Array of Image - Optional
    If this property is defined, then it will override the images property from the original product variant, otherwise images property from the original product variant would be copied in the resulting order.

Create an Order by Import

Creates directly an Order by importing it instead of creating it from a Cart. Each LineItem is referencing some existing product variant. You have 3 ways to specify a product reference:

  • productId + variant.id - this field combination will unique identify the product. In this case variant.sku would be initialized automatically in the resulting order.
  • variant.sku - SKU can also unique identify the product. productId and variant.id would be filled automatically.
  • productId + variant.id + variant.sku - you can also provide all 3 fields. In this case SKU would be validated.

Endpoint: /{projectKey}/orders/import
Method: POST
OAuth2 Scopes: manage_orders:{projectKey}
Request Body Representation: OrderImportDraft
Response Representation: Order

Specific Error Codes:

Importing an order produces the OrderImported message.