Creating an order
The order creation endpoint allows you to create a new order in Shoptet. Its primary purpose is to import old orders from other systems or to register an order created in another system (e.g., via Heureka). This endpoint is relatively complex due to the number of items, validations, and the variability of e-shops.
For a detailed description of the endpoint, see Order insertion in the API documentation. Pay close attention to the available request fields, including their format and default values.
Many order attributes are optional or have default values — see the documentation for details. Some fields, such as the billing and shipping addresses or contact details, may be mandatory or optional depending on the e-shop's settings. These are configured in the administration under Settings > Customers > Mandatory fields. For details, see the E-shop mandatory fields endpoint.
A typical simple order can be created by calling POST /api/orders with the following content:
Example request
{
"data": {
"email": "foo@bar.cz",
"externalCode": "123",
"paymentMethodGuid": "6f2c8e36-3faf-11e2-a723-705ab6a2ba75",
"shippingGuid": "8921cdc1-051b-11e5-a8d3-ac162d8a2454",
"billingAddress": {
"fullName": "Jan Novák",
"street": "Rovná",
"city": "Rovina",
"zip": "12300"
},
"currency": {
"code": "CZK"
},
"items": [
{
"itemType": "product",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithVat": "121.00"
},
{
"itemType": "billing",
"name": "Wire payment",
"vatRate": "21.00",
"unitPriceWithVat": "0"
},
{
"itemType": "shipping",
"name": "PPL",
"vatRate": "21.00",
"unitPriceWithVat": "59.00"
}
]
}
}
The older fields itemPriceWithVat / itemPriceWithoutVat are deprecated aliases of unitPriceWithVat / unitPriceWithoutVat and will be removed.
Sending a house number
Addresses can store house numbers in two ways. Some e-shop operators provide only a single street field, where customers enter the house number too, while others offer separate fields for the street and the house number.
In the request, these separate fields correspond to street and houseNumber. If you only have the street and house number combined in a single string, use the streetWithNr field (e.g., "Francouzská 28"). We will then either store it as a whole or split it into separate street and houseNumber fields as needed.
If you send street and houseNumber along with streetWithNr, the street and houseNumber fields take priority.
Different item types
The example above shows an order containing one product, a shipping item, and a payment item. The following sections show the parameters you need to send to the Shoptet API for different kinds of order content.
Orders can contain different types of items. Here we explain how to use them correctly so that Shoptet interprets them properly.
The itemType attribute specifies the type of item and can have the following values:
product– A standard product. Requires thecodeattribute. This is the most commonly used type.bazar– A second-hand product. Requires thecodeattribute.service– A service. Requires thecodeattribute.gift– A gift. Requires thecodeattribute.product-set– A product set. Requires thecodeattribute.billing– A payment. Specifies the payment fee in the order. Thecodeattribute is not used. The payment type is determined bypaymentMethodGuidin the data section. The billing method is set viabillingMethodCodein the data section (1 = cash on delivery, 2 = wire transfer, 3 = cash, 4 = card).shipping– A shipping method. Specifies the shipping cost in the order. Thecodeattribute is not used. The shipping type is determined byshippingGuidin the data section. For pickup points (e.g., Czech Post offices, Zásilkovna), specify the pickup location usingshippingDetails.branchId.discount-coupon– A discount coupon. Thecodeattribute is not used. Examples of specific discounts are provided below.volume-discount– A volume discount. Thecodeattribute is not used. Examples of specific discounts are provided below.
The product, bazar, service, and gift item types do not affect the product's status in the order. Therefore, we do not validate whether the product type in the database matches the submitted type.
Suppress parameters
When creating an order, you can use several suppress parameters (query parameters of the request) that change how the order is saved when set to true:
suppressDocumentGeneration– Suppresses the generation of related documents (e.g., invoices, delivery notes).suppressEmailSending– Suppresses sending the informational emails related to the order.suppressProductChecking– Suppresses the check that the products exist, based on their code and GUID.suppressStockMovements– Prevents the products from being deducted from stock when the order is created.suppressHistoricalMandatoryFields– Disables the validation of mandatory fields for historical orders (creationTimeolder than 24 hours).suppressHistoricalPaymentChecking– Allows thepaymentMethodGuidvalue to benullin historical orders.suppressHistoricalShippingChecking– Allows theshippingGuidvalue to benullin historical orders.
The three suppressHistorical… parameters can only be used for historical orders: the request must contain creationTime, and it must be more than 24 hours in the past. Otherwise, the request is rejected.
Example of a minimum order
A minimum order with delivery must contain three items: shipping, billing (payment), and product. Each order item must include at least the attributes itemType, vatRate, and either unitPriceWithVat or unitPriceWithoutVat. Prices must be specified as unit prices.
If you send shippingGuid, the order must contain a shipping item, and a shipping item requires shippingGuid (unless suppressHistoricalShippingChecking is used). The same applies to paymentMethodGuid and the billing item. Every order must also contain at least one item other than shipping and payment.
Some additional fields — such as the billing address, shipping address, and contact information — may be required depending on the e-shop settings (Settings > Customers > Mandatory fields).
{
"itemType": "shipping",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00"
}
Cash desk orders
Shoptet can also work as a store cash desk, where orders are created without separate shipping and payment items. You can create a cash desk order via the API by setting "cashDeskOrder": true in the data object.
In this mode:
- The customer's email is not required.
- Shipping and payment items do not need to be included.
- The order must contain at least one product.
Order and item statuses
In Shoptet, each order and each of its items have their own status, and these may differ. The basic order statuses are the same in all e-shops, but each e-shop can define additional custom statuses. For a complete list of order statuses, use the /api/orders/statuses endpoint.
You can set the status of both the entire order and individual items via the API using the statusId attribute. The order status is not necessarily applied to the order items; the behavior is explained below.
The /api/orders/statuses response includes a defaultStatus attribute, which indicates the default status for new orders. Another key attribute is changeOrderItems, which determines whether the order status is automatically applied to all items.
For example, let's assume that the order status list returns the following (simplified) output:
{
"data": {
"defaultStatus": 5,
"statuses": [
{
"id": 1,
"name": "Pending",
"changeOrderItems": true
},
{
"id": 2,
"name": "Packed",
"changeOrderItems": false
},
{
"id": 5,
"name": "New",
"changeOrderItems": false
}
]
}
}
And the following request (simplified again). The order-level statusId is shown with the value 1; the table below shows what happens for other values of this attribute (marked as X):
{
"data": {
"externalCode": "201900232323",
"statusId": 1,
"items": [
{
"itemType": "product",
"code": "product-A",
"statusId": 2
},
{
"itemType": "product",
"code": "product-B"
}
]
}
}
The statuses are then set as follows (each row is one variant of the request):
Product information tracking and existence check
For each order item with a specified code attribute, the system tries to find the corresponding product in the e-shop database.
- If the product exists, the system automatically fills in any missing details (e.g., name, weight, manufacturer, warranty).
- If the product does not exist, the system returns an error saying that it cannot find a product with the given
code.
If you need to create items that are not in the e-shop yet, you can bypass the existence check with the query parameter suppressProductChecking=true.
Each order item is identified by its code. Additionally, you can specify productGuid, which links the item to a specific product. This provides more precise tracking. If you send both, they must belong to the same product.
- If you send an invalid combination of
codeandproductGuid, the API returns422with the error codeinvalid-request-data. WithsuppressProductChecking=true, the item is stored without a link to a product instead.
Sample inputs for order creation
Regular product
{
"itemType": "product",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00"
}
Second-hand product
{
"itemType": "bazar",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00"
}
Service
{
"itemType": "service",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00"
}
Gift
{
"itemType": "gift",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithoutVat": "0.00",
"priceRatio": "0.0000"
}
A gift is free, so its price is 0.00.
Product set
{
"itemType": "product-set",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithoutVat": "300.00"
}
A product set must exist in the database, where its contents are defined.
- When creating an order, the system verifies that the product set exists and automatically adds its components.
- If you are importing historical orders, you can skip this check using
suppressProductChecking=true. - In this case, an unknown product set is treated as a regular product with the specified price.
Discount coupons
The following examples show the content of the data.items array of the request.
Discount coupon for a percentage discount
[
{
"itemType": "product",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00",
"priceRatio": "0.9700"
},
{
"itemType": "product",
"code": "24-FIA",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00",
"priceRatio": "0.9700"
},
{
"itemType": "discount-coupon",
"name": "Discount coupon PROMOTION-SUMMER, discount 3%",
"unitPriceWithoutVat": "0.00",
"vatRate": "21.00"
}
]
- The products carry their price before the discount;
priceRatiois the coefficient the price is multiplied by (a 3% discount means1 - 0.03 = 0.9700). - The
discount-couponitem has nocode; itsnameis the order item name, and the item itself is free (0.00).
Discount coupon for a specific amount (products with one VAT rate)
[
{
"itemType": "product",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00"
},
{
"itemType": "product",
"code": "24-FIA",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00"
},
{
"itemType": "discount-coupon",
"name": "Discount coupon PROMOTION-SUMMER-FIX, discount 25 CZK",
"unitPriceWithVat": "-25.00",
"vatRate": "21.00"
}
]
- The products carry their price before the discount.
- The
discount-couponitem has nocode; itsnameis the order item name. Its price is the exact (negative) amount of the discount, and itsvatRateis the same as the VAT rate of the order items.
Free shipping discount coupon
[
{
"itemType": "product",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00"
},
{
"itemType": "shipping",
"vatRate": "21.00",
"unitPriceWithoutVat": "0.00"
},
{
"itemType": "discount-coupon",
"name": "Discount coupon PROMOTION-SHIPPING - Shipping is free",
"unitPriceWithVat": "0.00",
"vatRate": "21.00"
}
]
- The
shippingitem has nocode, and its price is0.00because shipping is free. - The
discount-couponitem has nocode; itsnameis the order item name, the item itself is free (0.00), and itsvatRateis the same as the VAT rate of the order items.
Discount (e-shop operator adds it in administration)
[
{
"itemType": "product",
"code": "32/ZEL",
"vatRate": "21.00",
"unitPriceWithoutVat": "100.00"
},
{
"itemType": "volume-discount",
"name": "Discount",
"unitPriceWithVat": "-45.00",
"vatRate": "0.00"
}
]
- The product carries its original price.
- The
volume-discountitem has nocode; itsnameis the order item name, and its price is the additional discount of 45 CZK provided by the e-shop operator.
Discount coupon, discount and various VAT rates
If a discount coupon is applied to an order containing products with different VAT rates, the coupon must be sent twice — once with the VAT rate 0.00 and once with the applicable VAT rate (e.g., 21.00). When the order is processed in the e-shop administration, Shoptet automatically distributes the discount across the items according to their VAT rates. This ensures correct accounting and a clear breakdown of the discount within the order.