Hold and resume
Park the order of a customer who stepped away, serve the next one and resume the first: what the till does, what a held order does not keep and what is refused.
On this page
Holding parks an order with its lines and its customer so the till can serve the next customer. This guide holds Bon 1042 and resumes it.
Hold an order
Only an open order with at least one line can be held. The order becomes on_hold, and the till gets a new empty order: read the till for its new currentOrderId.
curl
curl -X POST "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/hold" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "0160d947-e58b-4076-8181-65b4675524a8",
"expectedRevision": 5
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/hold`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "0160d947-e58b-4076-8181-65b4675524a8",
"expectedRevision": 5
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/hold',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '0160d947-e58b-4076-8181-65b4675524a8',
'expectedRevision': 5,
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "0160d947-e58b-4076-8181-65b4675524a8",
"expectedRevision": 5
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/hold');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/hold");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "0160d947-e58b-4076-8181-65b4675524a8",
"expectedRevision": 5
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "0160d947-e58b-4076-8181-65b4675524a8",
"status": "accepted",
"aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"aggregateRevision": 6
} List the held orders of the till
curl
curl "$RDC_BASE_URL/pos/v1/orders?tillId=e57a3b65-d690-4e6c-8a6b-8f946c4e6610&status=on_hold" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders?tillId=e57a3b65-d690-4e6c-8a6b-8f946c4e6610&status=on_hold`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/pos/v1/orders?tillId=e57a3b65-d690-4e6c-8a6b-8f946c4e6610&status=on_hold',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders?tillId=e57a3b65-d690-4e6c-8a6b-8f946c4e6610&status=on_hold');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/pos/v1/orders?tillId=e57a3b65-d690-4e6c-8a6b-8f946c4e6610&status=on_hold");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Resume an order
The current order of the till must be empty. If the next customer has items on it, finish, hold or void that order first, or the answer is sale_in_progress. Send the revision of the held order, 6: holding it was a change. The empty order the till got when you held is dropped.
Resume the held order
curl
curl -X POST "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/resume" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "2071ffe1-71e0-44f8-b2f2-6ad00bd225e2",
"expectedRevision": 6
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/resume`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "2071ffe1-71e0-44f8-b2f2-6ad00bd225e2",
"expectedRevision": 6
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/resume',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '2071ffe1-71e0-44f8-b2f2-6ad00bd225e2',
'expectedRevision': 6,
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "2071ffe1-71e0-44f8-b2f2-6ad00bd225e2",
"expectedRevision": 6
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/resume');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/resume");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "2071ffe1-71e0-44f8-b2f2-6ad00bd225e2",
"expectedRevision": 6
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "2071ffe1-71e0-44f8-b2f2-6ad00bd225e2",
"status": "accepted",
"aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"aggregateRevision": 7
} The order is open again and is the current order of the till, with its lines and its customer. Pay it as usual: see Take a sale.
Void a held order
A held order is voided like any unpaid order, without resuming it: send voidOrder with the revision of the held order, 6. See Refund and void.
Held orders and the day
A business day cannot close while an order is on hold: closeBusinessDay answers held_orders. Resume or void the held orders first. See Close the day.
Events
Holding and resuming send no event. A held order sends order.voided when it is voided, and order.paid once it is resumed and paid. See Event catalogue.
When a request is refused
| Code | HTTP | What to do |
|---|---|---|
empty_order | 422 | Add a line before you hold the order. |
invalid_status | 422 | Only an open order can be held and only an on_hold order can be resumed. Read the order. |
sale_in_progress | 422 | Finish, hold or void the current order of the till, then resume. |
revision_conflict | 409 | Read the order again and send the change with a new operationId. |
out_of_stock | 422 | Raised when payment starts. Lower the quantity or remove the line. |