shop.order.add
Creates a new order.
Parameters
-
items
POST
Array of ordered product variants. The sub-array of each order item must contain values with the following keys:
- sku_id: Product variant ID.
- quantity (optional): Order item quantity. If not specified then default value 1 is used.
- services (optional): Information about services that must be applied to order items, as an array. Each array item must be an array with a single key 'service_variant_id' containing a service variant ID. -
contact_id
POST
Optional
Customer contact ID.
-
contact
POST
Optional
Customer contact ID. Alternative option if contact_id is not specified.
-
comment
POST
Optional
Comment text.
-
access_token
GET
API auth token obtained during the API authorization.
-
format
GET
Optional
Sets response format. Available options:
json
(default),xml
.
Array of created order’s data with the following keys:
- id int Order ID.
- contact_id int Customer contact ID.
- create_datetime datetime Order creation date and time.
- total float Order total cost, expressed in the order currency, in the
decimal(15,4)
format. - currency string 3-letter order currency ID in the ISO 4217 format.
- shipping float Shipping cost, expressed in the order currency, in the
decimal(15,4)
format. - discount float Discount amount, expressed in the order currency, in the
decimal(15,4)
format. - rate float Order currency rate towards the main store currency.
- tax float Amount of the applied taxes, expressed in the order currency, in the
decimal(15,4)
format. - params array Order parameters array.
- contact array Customer data array with the following keys:
- contact['id'] int Customer contact ID.
- contact['name'] string Full name.
- contact['email'] string Email address.
- contact['phone'] string Phone number.
- contact['registered'] bool Whether the customer is registered and is allowed to sign into their account with a password.
- contact['photo_50x50'] string Customer’s photo URL or a link to their Gravatar image.
- items array Array of ordered products and services:
- items[]['id'] int Order item ID.
- items[]['order_id'] string Order ID.
- items[]['name'] string Order item name.
- items[]['product_id'] int ID of the ordered product.
- items[]['sku_id'] int ID the ordered product variant.
- items[]['sku_code'] string Code of the ordered product variant.
- items[]['type'] string Order item type — 'product' or 'service'.
- items[]['service_id'] int Service ID if the order item is a service.
- items[]['service_variant_id'] int Service variant ID if the order item is a service.
- items[]['price'] float Order item price, expressed in the order currency, in the
decimal(15,4)
format. - items[]['quantity'] float Order item quantity in the
decimal(15,3)
format. - items[]['quantity_denominator'] int Available precision for stock quantities. Acceptable values: 1 (whole pieces), 10 (precision to tenths), 100 (precision to hundredths), 1000 (precision to thousandths).
- items[]['stock_id'] int ID of the stock from which ordered product’s quantity must be withdrawn.
- items[]['virtual_stock_id'] int ID of the virtual stock from which ordered product’s quantity must be withdrawn.
- items[]['purchase_price'] float Ordered product’s purchase price, expressed in the order currency, in the
decimal(15,4)
format. - items[]['total_discount'] float Discount amount calculated for the entire quantity of the ordered product, expressed in the order currency, in the
decimal(15,4)
format. - items[]['tax_percent'] float Percentage of the applied tax in the
decimal(15,4)
format. - items[]['tax_included'] int Flag (0 or 1) denoting whether the tax amount is included in the product price.
- items[]['stock_unit_id'] int Ordered product’s stock quantity unit ID.
- items[]['image_id'] int Product image ID from the ordered.