[POST] .../v1/docorderdelivery/add
Creates a new retail order document. Use this method to create a retail order delivery document header before adding order operations and moving the order through approval, processing, payment and completion statuses. The request requires date and from_id, validates optional delivery location coordinates and can include stock, customer, retail card, price type, delivery type, payment type, courier, fiscal QR URL, address, phone, external code and description. The method requires the retail order add permission, applies tariff and allowed-stock checks, resolves default stock when stock_id is not supplied, writes the action log, sends order-created notifications/webhooks and returns new_id. Business errors such as a missing request body, invalid date, missing source, invalid coordinates, denied access, disabled retail-orders tariff, inaccessible or missing stock, invalid related records, database errors or persistence failures are returned as HTTP 200 ErrorResult.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| address | String | Optional | Order delivery address. |
| card_id | Int64 | Optional | Customer card ID. |
| courier_id | Int64 | Optional | Courier ID. |
| customer_id | Int64 | Optional | Customer ID. |
| date | Int64 | Required | Retail order document date as Unix time in seconds. |
| delivery_date | Int64 | Optional | Retail order delivery date as Unix time in seconds. |
| delivery_type_id | Int64 | Optional | Delivery type ID. |
| description | String | Optional | Additional description. |
| external_code | String | Optional | Order code in the external system. |
| from_id | Int64 | Required | Retail order source ID. Required and must be greater than or equal to 1. |
| location | Location | Optional | Delivery location. |
| payment_type_id | Int64 | Optional | Payment type ID. |
| phone | String | Optional | Phone number. |
| price_type_id | Int64 | Required | Price type ID. |
| qrcodeurl | String | Optional | Fiscal cheque link printed in the cheque QR code. |
| stock_id | Int64 | Optional | Stock ID. |
Request Example
{
"address": "string",
"card_id": 1,
"courier_id": 1,
"customer_id": 1,
"date": 1,
"delivery_date": 1,
"delivery_type_id": 1,
"description": "string",
"external_code": "string",
"from_id": 1,
"location": {
"latitude": 1.0,
"longitude": 1.0
},
"payment_type_id": 1,
"phone": "string",
"price_type_id": 1,
"qrcodeurl": "string",
"stock_id": 1
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Insert | Created record result. |
Response Example
{
"ok": true,
"result": {
"new_id": 1
}
}