Description

PurposeCreate a restaurant order by objectId
Request typeAsynchronous/synchronous
Supported agent versionv1, v2
PluggetSystemTypeRKMid

Request format

Description of parameters

{
  "taskType": "CreateOrder",
  "params": {
    "async": {
      "objectId": number,
       "timeout": number,
       "systemName": "string"
     },
    "sync": {
      "objectId": number,
       "timeout": number,
       "systemName": "string"
    },
     "order": {
        "withRkId": "GUID",
        "originalOrderId": "string",
        "sourceOrderId": "string",
        "payMethod": "string",
        "booking":{
            "time": "string",
            "duration":{
                "hours": number,
                "minutes": number
            }
        },
        "expectedStartTime": "string",        
        "customer": {
           "name": "string",
           "phone": "string",
           "email": "string"
        },
        "pickup": {
          "courier": {
              "name": "string",
              "phone": "string"           
           },
           "expectedTime": "2019-10-17T00:00:00+03:00",
           "taker": "customer"
        },
        "payment": {
          "type": "string"
          "nettingPayment": boolean,
          "deliveryFee": number
         },
        "expeditionType": "string",
        "delivery": {
           "expectedTime": "2008-10-17T00:00:00+03:00",
           "address": {
              "fullAddress": "string",
              "subway": "string",
              "region": "string",
              "city": {
                "name": "string"
              },
              "street": {
                "name": "string"
              },
              "houseNumber": "string",
              "flatNumber": "string",
              "entrance": "string",
              "intercom": "string",
              "floor": "string",
              "coordinates": {
                "latitude": "string",
                "longitude": "string"
              },
             "comment":"string"
           }
        },
        "courier": {
              "name": "string",
              "phone": "string"          
           }
        },
        "changeBackFrom": number,        
        "products": [
           { // simple option
             "id": number,
             "name": "string",
             "price": "string", // The parameter is optional. It can be left blank since the order is created with the price indicated at the cash register
             "quantity": number,
             "comment": "string",
             "discountIds": [
                {
                  "id": number,
                  "value":number
                }
             ],
             "yandexPromos": [
                 {
                    "type": "string",
                    "discount: number
                 }
             ]
          },
          { // option with modifiers or combo
             "id": number,
             "name": "string",
             "price": number, // The parameter is optional. It can be left blank since the order is created with the price indicated at the cash register
             "quantity": number,
             "comment": "string"
             "ingredients": [ //array of modifiers or combo elements                {
                  "id": number,
                  "name": "string",
                  "quantity": number,
                  "price": number, // The parameter is optional. It can be left blank since the order is created with the price indicated at the cash register
                  "yandexPromos": [
                    {
                       "type": "string",
                       "discount: number
                    }
                  ],
                  "ingredients": [ //array of modifiers for combo components. Available only from agent version 2.7.9.1 onwards
                   {
                     "id": number,
                     "name": "string",
                     "quantity": number,
                     "price": number // The parameter is optional. It can be left blank since the order is created with the price indicated at the cash register
                   }
                  ]
               }
             ]
          }
        ],
        "platform": "string",
        "comment": "string",
        "price": {
           "total": number
        },
        "personsQuantity": number,
        "tableCode": number,
        "extraTableCodes": [
           1,
           2
        ],
        "orderCategoryCode": number,
        "orderTypeCode": number,
        "prePayments": [
         {
            "amount": number,
            "currency": "guid"
         }
        ],
        "guestTypeId": number,
        "discountIds": [
           number,
           number
        ],
// or
        "discountIds": [
            {
                "id": number,
                "value":number
            }
        ],
        "source": "string",
        "yandexPromos": [
           {
              "type": "string",
              "discount: number
           }
        ]
      }
  }
}

Parameter

Type

Mandatory

Description

Default value

async
-Asynchronous method call (either synchronous or asynchronous)
sync
-Synchronous method call (either synchronous or asynchronous)
timeoutint-Agent response time in seconds120 seconds
objectIdintyesRestaurant code in the licensing system
systemNamestringнетSpecifying the particular connected system for which the request is being made
order
yes

withRkId

GUID-

If specified, the order is created in r_keeper with the specified guid value. Valid only for agent versions 2.5.4.10 and above


originalOrderIdstring-External order number
sourceOrderIdstring-Initial order identifier (for example, identifier in the Yandex system). Optional. Saved in r_keeper in the extended field of the same name
bookingobject-

Reservation of an order (table) for a specified time.

If a connection to KDS PRO is configured, you need to make additional settings on the KDS PRO side - in the Operations on postponed dishes section, set When the cooking time arrives.

  1. The beginning can be found in the chapter Serving Orders.
  2. There is the same parameter in the Order Display Parameters.

|-timedateTime+Booking start time in the format YYYY-MM-DDTHH:MM:SS
|-durationobject+Duration of the reservation
   |-hoursnumber+Duration in hours
   |-minutesnumber+Duration in minutes
expectedStartTimestring-Planned start time of order preparation. Optional. Saved in r_keeper in the extended field of the same name
paymentobject-

  |- type

stringyesPayment type: cash – payment in cash, card – payment by card, online – online payment. In case of online option we consider that the order is paid

  |- nettingPayment

boolean-If True, then the order is for mutual settlement from Yandex
  |- deliveryFeedecimal-Delivery Cost. Only for delivery multi-agent
customerobject-Guest
  |- namestring-Guest name
  |- phonestring-Guest phone
  |- email3string-Guest Email
expeditionTypestringyesDelivery type. Options: delivery, pickup. You can save the value via the order type and category.
pickupobject-Pickup if expeditionType = pickup
  |- courierobject-Information about the courier
    |- namestring-The name of the courier, if taker = courier
    |-  phonestring-Courier's phone number, if taker = courier
  |- expectedTimeDateTimeyesTime by which the order must be ready
  |- takerstringyesWho will pick up the order from the restaurant. Options: courier, customer. The value can be saved via the order type and category
deliveryobject-Delivery by restaurant courier if expeditionType = delivery
  |- addressobject-Address
    |- fullAddressstring-Full address
    |- subwaystring-Subway
    |- regionstring-Region
    |- cityobject-

      |- namestring-City
    |- streetobject-

      |- namestring-Street
  |- houseNumberstring-Building number
  |- flatNumberstring-Apartment number
  |- entrance1string-Entrance
  |- intercom1string-Intercom
  |- floorstring-Floor
  |- coordinates
-Coordinates
    |- latitudestring-Latitude
    |- longitudestring-Longitude
  |- commentstring-Comment to the address
|- courierobject-Information about the courier
   |- namestring-Courier name
   |-  phonestring-Courier phone number
changeBackFromdecimal-

The amount for which change is needed


productsarrayyesOrder content
  |- idintyesDish ID
  |- namestring-Name of the dish
  |- pricemoney-Price for one dish. The separator between the whole and fractional parts of the amount must be a dot
  |- quantitymoneyyesNumber of dishes
  |- discountIdsarray-Array of cash discount identifiers for dishes
     |- idint-Discount ID
     |- valuedecimal-Discount value. Specify the amount or percentage. 0 is full application of the discount. Both positive and negative values ​​can be specified.
  |- yandexPromosarray-List of Yandex.Eda service promotions for a dish. Served only by a multi-agent delivery
     |- typestring+Type of promo (GIFT/PERCENTAGE/FIXED/COFINANCE)
     |- discountnumber+The value of a promotional discount
     |- partnerDiscountnumber-The partnerDiscount and yandexDiscount fields appear if the discount type is COFINANCE
     |- yandexDiscountnumber-the partnerDiscount and yandexDiscount fields appear if the discount type is COFINANCE
  |- commentstring-Commentary on the dish. Only for agent versions 2.6.7.1 and above
  |- ingredientsarray-Ingredients or content of a combo dish
      |- idintyesIngredient ID
      |- namestring-Name of modifier or combo component
      |- quantitymoney-Quantity
      |- pricemoney-Price
      |- ingredientsarray-Array of modifiers for combo components. Only for agent versions 2.7.9.1 and above
          |- idintyesModifier ID
          |- namestring-Modifier name
          |- quantitymoney-Quantity
          |- pricemoney-Price
tableCode3int-Table Code (Agent v2 only)
extraTableCodes3int[]-Additional tables for booking (Agent v2 only)
orderCategoryCode4int-Order category code (agent v2 only). If not specified, taken from default settings
orderTypeCode4int-Order type code (Agent v2 only). If not specified, taken from default settings
prePaymentsarray-

Prepayment data array (optional). Available only from agent version 2.6.7.3 onwards.

  • if specified, only these payments apply (price.total and payment.type is added when adding payments)
  • if not specified, then:
    • if payment.type = online, then payment in the default currency of the price.total amount
    • otherwise the payment is not added to the order (price.total is ignored when adding payments)

- amount

money+The value of the amount to be paid. The separator between the integer and fractional parts of the amount must be a dot

- currency

guid+

currency guid


guestTypeId3int-Guest type ID. If not specified, taken from the Restaurant Order Creation Options settings
discountIds2,3int[]/ object[]-

Array of cash discount identifiers. GetRefData(DISCOUNTS).Ident

Only from agent versions 2.7.3.20 and above


- idint
Discount ID
- valuedecimal
Discount value. Specify the amount or percentage. 0 is full application of the discount. Both positive and negative values ​​can be specified.
sourcestring-Extended Property Order Source GetRefData(ENUMSTYPESDATAS).EnumValue
platformstring-Only for orders from Yandex.Service. Platform type (YA, DC) where the order came from
yandexPromosarray-List of Yandex.Eda service promotions for the entire order. Served only by a multi-agent delivery
|- typestring+Type of promo (GIFT/PERCENTAGE/FIXED/COFINANCE)
|- discountnumber+The value of a promotional discount
|- partnerDiscountnumber-The partnerDiscount and yandexDiscount fields appear if the discount type is COFINANCE
|- yandexDiscountnumber-The partnerDiscount and yandexDiscount fields appear if the discount type is COFINANCE
payMethodstring-Payment method. From WSA version 2.8.2.1

Notes


1Currently WSA2 is ignored (typos in field names on the WSA side)
2Currently DTO WS is ignored (no fields in DTO)
3Field missing in multi-agent DTO (delivery service)
4The field is present in the multi-agent DTO (delivery service), but is not used in the logic

Response format

{
   "responseCommon":{
      "taskGuid":"guid",
      "taskType":"CreateOrder",
      "objectId":number
   },
   "error":{
      "wsError":{
         "code":"string",
         "desc":"string"
      }
   }
}

Parameter

Type

Description

taskGuidguidThe unique code of this task is used when receiving the task through the queue.
taskTypestring enumTask type
objectIdintRestaurant code in the licensing system
error
Error container, see Error description

 Asynchronous response format

// Successful response, order accepted at cash registercheckout
{
  "taskResponse": {
     "order": {
        "orderGuid": "guid",
        "tableCode": number,
        "queuePosition": "string"
      }
  },
  "responseCommon": {
    "taskGuid": "guid",
    "taskType": "CreateOrder",
    "objectId": number
  }
}
  
// Successful response, order accepted at cash register
{
  "taskResponse": {
     "order": {
        "status": {
            "value": "string"
        },
        "rejectingReason": {
            "code": "string",
            "message": "string"
        }
      }
  },
  "responseCommon": {
    "taskGuid": "string",
    "taskType": "CreateOrder",
    "objectId": number
  }
}
  
// Response with an error
{
  "responseCommon": {
    "taskGuid": "string",
    "taskType": "CreateOrder",
    "objectId": number
  },
  "error": {
    "wsError": {
      "code": "string",
      "desc": "string"
    },
    "agentError": {
      "code": string,
      "desc": "string"
    }
  }
}

Description of parameters

Parameter

Parameter type

Mandatory

Description

orderGuidguid-Obtained from r_keeper Guid of the created order
tableCodeint-Table code
statusobject-
  |- valuestring-Order status. Restaurant Cancelled will return if the order is cancelled at the restaurant
  |- isBillPrintedboolyesMark indicating whether the order guest bill has been printed
rejectingReason
-
  |- codestring-Cancellation code at cash register
  | -messagestring-Reason for order cancellation at cash register
errorstring enum-Error container, see Error Description

queuePosition

string-The queue number generated by RK7. WSA 2.7.7.1, RK7 7.06.05.459. It is generated according to the rule: the cash register code is transmitted as a Latin letter + the last digits of the order number

Example api json request from client


{
  "taskType": "CreateOrder",
  "params": {
    "async": {
      "objectId": 199995826,
      "timeout": 60
    },
    "order": {
      "originalOrderId": "string",
      "customer": {
        "name": "string",
        "phone": "string"
      },
      "payment": {
        "type": "string"
      },
      "expeditionType": "string",
      "delivery": {
        "expectedTime": "2008-10-17T00:00:00+0300",
        "address": {
          "subway": "string",
          "region": "string",
          "city": {
            "name": "string"
          },
          "street": {
            "name": "string"
          },
          "houseNumber": "string",
          "flatNumber": "string",
          "entrance": "string",
          "intercom": "string",
          "floor": "string",
          "coordinates": {
            "latitude": "string",
            "longitude": "string"
          },
          "comment":"string"
        }
      },
      "products": [
        {
          "id": "string",
          "name": "string",
          "price": "string",
          "quantity": 0,
          "ingredients": [
            {
              "id": "string",
              "name": "string",
              "quantity": 0,
              "price": "string"
            },
            {
              "id": "string",
              "name": "string",
              "quantity": 0,
              "price": "string"
            }
          ]
        },
        {
          "id": "string2",
          "name": "string",
          "price": "string",
          "quantity": 0,
          "ingredients": [
            {
              "id": "string",
              "name": "string",
              "quantity": 0,
              "price": "string"
            },
            {
              "id": "string2",
              "name": "string",
              "quantity": 0,
              "price": "string"
            }
          ]
        }
       ],
      "comment": "string",
      "price": {
        "total": 0
      },
      "personsQuantity": 0,
      "discountIds": [1000032],
// or
      "discountIds": [
                {
                    "id": 1000032,
                    "value": 11.50
                }
          ],
       "source": "kiosk" 
      }
  }
}