Order preview
Validates an order without creating it and returns the computed quote (total, delivery fee and applied coupons, including automatic ones). Accepts the same payload as order creation.
curl --request POST \
--url https://app.xmenu.it/api/order/preview \
--header 'Content-Type: application/json' \
--header 'X-Client-Id: <api-key>' \
--header 'X-Client-Secret: <api-key>' \
--data '
{
"client": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"dmethod": "<string>",
"details": [
{
"product": {
"uid": "<string>"
},
"quantity": 123,
"notes": "<string>",
"options": [
{
"uid": "<string>",
"values": [
{
"uid": "<string>",
"quantity": 123
}
]
}
]
}
],
"subrestaurant_uid": "<string>",
"language": "<string>",
"payment_method_sub": "<string>",
"notes": "<string>"
}
'import requests
url = "https://app.xmenu.it/api/order/preview"
payload = {
"client": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"dmethod": "<string>",
"details": [
{
"product": { "uid": "<string>" },
"quantity": 123,
"notes": "<string>",
"options": [
{
"uid": "<string>",
"values": [
{
"uid": "<string>",
"quantity": 123
}
]
}
]
}
],
"subrestaurant_uid": "<string>",
"language": "<string>",
"payment_method_sub": "<string>",
"notes": "<string>"
}
headers = {
"X-Client-Id": "<api-key>",
"X-Client-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Client-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
client: {
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>'
},
dmethod: '<string>',
details: [
{
product: {uid: '<string>'},
quantity: 123,
notes: '<string>',
options: [{uid: '<string>', values: [{uid: '<string>', quantity: 123}]}]
}
],
subrestaurant_uid: '<string>',
language: '<string>',
payment_method_sub: '<string>',
notes: '<string>'
})
};
fetch('https://app.xmenu.it/api/order/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.xmenu.it/api/order/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client' => [
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>'
],
'dmethod' => '<string>',
'details' => [
[
'product' => [
'uid' => '<string>'
],
'quantity' => 123,
'notes' => '<string>',
'options' => [
[
'uid' => '<string>',
'values' => [
[
'uid' => '<string>',
'quantity' => 123
]
]
]
]
]
],
'subrestaurant_uid' => '<string>',
'language' => '<string>',
'payment_method_sub' => '<string>',
'notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Client-Id: <api-key>",
"X-Client-Secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.xmenu.it/api/order/preview"
payload := strings.NewReader("{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Client-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.xmenu.it/api/order/preview")
.header("X-Client-Id", "<api-key>")
.header("X-Client-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.xmenu.it/api/order/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-Id"] = '<api-key>'
request["X-Client-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"error": "<string>",
"message": "<string>",
"order": {
"total": 123,
"delivery_fee": 123,
"pickup_date": "2023-11-07T05:31:56Z",
"delivery_date": "2023-11-07T05:31:56Z",
"coupon": {
"code": "<string>",
"description": "<string>",
"discount": 123,
"auto": true
}
}
}write:ordersAuthorizations
Client ID for API Client authentication (must be used together with Client Secret)
Client Secret for API Client authentication (must be used together with Client ID)
Body
Show child attributes
Show child attributes
Delivery method:
0= pickup at location1= home delivery0t= at table20= pickup at pickup point0e-{id}= event (where {id} is the event ID)dcf-{id}= custom method (where {id} is the method ID)
Payment method:
cash= cashinvoice= invoiceexternal= externally handled
cash, invoice, external Order items (products with quantities/options)
Show child attributes
Show child attributes
Location identifier. Required for multi-location restaurants
ISO 639-1 language code; defaults to restaurant settings
Pickup data. Required for dmethod=0
Show child attributes
Show child attributes
Delivery data. Required for dmethod=1
Show child attributes
Show child attributes
Payment sub-method. Required if payment_method=cash
Coupon to apply to the order.
Show child attributes
Show child attributes
General order notes
Order origin:
customer= self-placed online order (default)restaurant= phone order placed by the restaurant on behalf of the customer
customer, restaurant Response
Order preview response
Operation result: true if the order is valid, false if failed
Error code if validation failed (same as order creation). Possible values:
PRODUCT_NOT_FOUND= product not foundPRODUCT_NOT_AVAILABLE= product unavailableOPTION_NOT_FOUND= option not foundOPTION_VALUE_NOT_FOUND= option value not foundINVALID_ADDRESS= invalid address or out of zoneCOUPON_ERROR= coupon application errorSUBRESTAURANT_NOT_FOUND= location not found
See Error codes for general error codes that may occur.
Human-readable error description if validation failed
Computed order quote (present only if success = true). No order is created.
Show child attributes
Show child attributes
curl --request POST \
--url https://app.xmenu.it/api/order/preview \
--header 'Content-Type: application/json' \
--header 'X-Client-Id: <api-key>' \
--header 'X-Client-Secret: <api-key>' \
--data '
{
"client": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"dmethod": "<string>",
"details": [
{
"product": {
"uid": "<string>"
},
"quantity": 123,
"notes": "<string>",
"options": [
{
"uid": "<string>",
"values": [
{
"uid": "<string>",
"quantity": 123
}
]
}
]
}
],
"subrestaurant_uid": "<string>",
"language": "<string>",
"payment_method_sub": "<string>",
"notes": "<string>"
}
'import requests
url = "https://app.xmenu.it/api/order/preview"
payload = {
"client": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"dmethod": "<string>",
"details": [
{
"product": { "uid": "<string>" },
"quantity": 123,
"notes": "<string>",
"options": [
{
"uid": "<string>",
"values": [
{
"uid": "<string>",
"quantity": 123
}
]
}
]
}
],
"subrestaurant_uid": "<string>",
"language": "<string>",
"payment_method_sub": "<string>",
"notes": "<string>"
}
headers = {
"X-Client-Id": "<api-key>",
"X-Client-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Client-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
client: {
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>'
},
dmethod: '<string>',
details: [
{
product: {uid: '<string>'},
quantity: 123,
notes: '<string>',
options: [{uid: '<string>', values: [{uid: '<string>', quantity: 123}]}]
}
],
subrestaurant_uid: '<string>',
language: '<string>',
payment_method_sub: '<string>',
notes: '<string>'
})
};
fetch('https://app.xmenu.it/api/order/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.xmenu.it/api/order/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client' => [
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>'
],
'dmethod' => '<string>',
'details' => [
[
'product' => [
'uid' => '<string>'
],
'quantity' => 123,
'notes' => '<string>',
'options' => [
[
'uid' => '<string>',
'values' => [
[
'uid' => '<string>',
'quantity' => 123
]
]
]
]
]
],
'subrestaurant_uid' => '<string>',
'language' => '<string>',
'payment_method_sub' => '<string>',
'notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Client-Id: <api-key>",
"X-Client-Secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.xmenu.it/api/order/preview"
payload := strings.NewReader("{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Client-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.xmenu.it/api/order/preview")
.header("X-Client-Id", "<api-key>")
.header("X-Client-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.xmenu.it/api/order/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-Id"] = '<api-key>'
request["X-Client-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\"\n },\n \"dmethod\": \"<string>\",\n \"details\": [\n {\n \"product\": {\n \"uid\": \"<string>\"\n },\n \"quantity\": 123,\n \"notes\": \"<string>\",\n \"options\": [\n {\n \"uid\": \"<string>\",\n \"values\": [\n {\n \"uid\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ],\n \"subrestaurant_uid\": \"<string>\",\n \"language\": \"<string>\",\n \"payment_method_sub\": \"<string>\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"error": "<string>",
"message": "<string>",
"order": {
"total": 123,
"delivery_fee": 123,
"pickup_date": "2023-11-07T05:31:56Z",
"delivery_date": "2023-11-07T05:31:56Z",
"coupon": {
"code": "<string>",
"description": "<string>",
"discount": 123,
"auto": true
}
}
}