Take a sale
Ring up the current order of a till: read it, add items by sku or barcode, change a line, set the customer and take payment by card or in cash.
On this page
A sale is the current order of a till. Every change below carries an operationId and the expectedRevision you read, and answers 202 with the operation result; see Idempotency. The sale in this guide is Bon 1042 at Till 1.
Read the order
Read the till for currentOrderId: the order being rung up, empty until the first item. Then read the order for its status, lines, total, due and revision. You send the revision back as expectedRevision.
curl
curl "$RDC_BASE_URL/pos/v1/tills/e57a3b65-d690-4e6c-8a6b-8f946c4e6610" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/tills/e57a3b65-d690-4e6c-8a6b-8f946c4e6610`, {
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/tills/e57a3b65-d690-4e6c-8a6b-8f946c4e6610',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/tills/e57a3b65-d690-4e6c-8a6b-8f946c4e6610');
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/tills/e57a3b65-d690-4e6c-8a6b-8f946c4e6610");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "e57a3b65-d690-4e6c-8a6b-8f946c4e6610",
"code": "till-1",
"name": "Till 1",
"cashier": "Cristina Lungu",
"businessDayId": "aaed5ba1-2a19-4c94-ac7f-119c9288a12c",
"currentOrderId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"network": "online",
"queue": {
"count": 0,
"oldestAt": null,
"ageSeconds": 0
},
"reader": {
"state": "idle",
"orderId": null,
"amount": "0.00",
"attempt": 0
}
} curl
curl "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62`, {
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/9d8c072d-afa0-4272-97ab-4443d54d5b62',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62');
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/9d8c072d-afa0-4272-97ab-4443d54d5b62");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"number": "Bon 1042",
"tillId": "e57a3b65-d690-4e6c-8a6b-8f946c4e6610",
"businessDayId": "aaed5ba1-2a19-4c94-ac7f-119c9288a12c",
"cashier": "Cristina Lungu",
"customerId": null,
"createdAt": "2026-11-23T07:08:00Z",
"status": "open",
"lines": [
{
"sku": "PA-0101",
"name": "White bread, 500 g",
"quantity": "2",
"unitPrice": "4.80",
"discountPercent": 0,
"discount": "0.00",
"total": "9.60"
},
{
"sku": "UL-0101",
"name": "Sunflower oil, 1 l",
"quantity": "2",
"unitPrice": "9.80",
"discountPercent": 0,
"discount": "0.00",
"total": "19.60"
},
{
"sku": "LA-0307",
"name": "Cheese, 400 g",
"quantity": "1",
"unitPrice": "21.50",
"discountPercent": 0,
"discount": "0.00",
"total": "21.50"
},
{
"sku": "DT-0101",
"name": "Dishwashing liquid, 1 l",
"quantity": "1",
"unitPrice": "12.50",
"discountPercent": 10,
"discount": "1.25",
"total": "11.25"
}
],
"subtotal": "63.20",
"discount": "1.25",
"total": "61.95",
"vatBreakdown": [
{
"rate": "21",
"total": "11.25",
"vat": "1.95",
"base": "9.30"
},
{
"rate": "11",
"total": "50.70",
"vat": "5.02",
"base": "45.68"
}
],
"vat": "6.97",
"currency": "RON",
"paid": "0.00",
"due": "61.95",
"refunded": "0.00",
"payments": [],
"refunds": [],
"sync": null,
"revision": 5
} Add items
Send the sku or the barcode of the item, not both, and a quantity: a whole number from 1, written as a string. Units of an item that is already on the order are added to its line.
curl
curl -X POST "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "fa72d355-ece7-4ef3-877a-21e26eef40b1",
"expectedRevision": 5,
"sku": "SA-0101",
"quantity": "1"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "fa72d355-ece7-4ef3-877a-21e26eef40b1",
"expectedRevision": 5,
"sku": "SA-0101",
"quantity": "1"
}),
});
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/lines',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'fa72d355-ece7-4ef3-877a-21e26eef40b1',
'expectedRevision': 5,
'sku': 'SA-0101',
'quantity': '1',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "fa72d355-ece7-4ef3-877a-21e26eef40b1",
"expectedRevision": 5,
"sku": "SA-0101",
"quantity": "1"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines');
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/lines");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "fa72d355-ece7-4ef3-877a-21e26eef40b1",
"expectedRevision": 5,
"sku": "SA-0101",
"quantity": "1"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "fa72d355-ece7-4ef3-877a-21e26eef40b1",
"status": "accepted",
"aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"aggregateRevision": 6
} When the code comes from a scan, send the string as it is in barcode.
Add an item by barcode
curl
curl -X POST "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "331d60a5-0337-4f90-9667-9b184994119f",
"expectedRevision": 6,
"barcode": "20001988",
"quantity": "1"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "331d60a5-0337-4f90-9667-9b184994119f",
"expectedRevision": 6,
"barcode": "20001988",
"quantity": "1"
}),
});
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/lines',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '331d60a5-0337-4f90-9667-9b184994119f',
'expectedRevision': 6,
'barcode': '20001988',
'quantity': '1',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "331d60a5-0337-4f90-9667-9b184994119f",
"expectedRevision": 6,
"barcode": "20001988",
"quantity": "1"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines');
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/lines");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "331d60a5-0337-4f90-9667-9b184994119f",
"expectedRevision": 6,
"barcode": "20001988",
"quantity": "1"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "331d60a5-0337-4f90-9667-9b184994119f",
"status": "accepted",
"aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"aggregateRevision": 7
} Change a line
Set the quantity, the discount or both on the line named in the path. The discount is a whole percentage of the line, up to the limit of the cashier profile: 10% for Cristina Lungu. A higher one is refused with discount_limit.
Give a line a discount of 5%
curl
curl -X PATCH "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines/PA-0101" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "0ac9387a-251b-43aa-893d-efee13273421",
"expectedRevision": 7,
"discountPercent": 5
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines/PA-0101`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "0ac9387a-251b-43aa-893d-efee13273421",
"expectedRevision": 7,
"discountPercent": 5
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'PATCH',
f'{os.environ["RDC_BASE_URL"]}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines/PA-0101',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '0ac9387a-251b-43aa-893d-efee13273421',
'expectedRevision': 7,
'discountPercent': 5,
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "0ac9387a-251b-43aa-893d-efee13273421",
"expectedRevision": 7,
"discountPercent": 5
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines/PA-0101');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
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.Patch, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/lines/PA-0101");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "0ac9387a-251b-43aa-893d-efee13273421",
"expectedRevision": 7,
"discountPercent": 5
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "0ac9387a-251b-43aa-893d-efee13273421",
"status": "accepted",
"aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"aggregateRevision": 8
} Set the customer
Attach a customer to the open order, or send null to remove it. The customer travels with the order in its events.
Set the customer
curl
curl -X PATCH "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "1872a165-e231-4bb2-b651-d1a9e16e905a",
"expectedRevision": 8,
"customerId": "bc49ac2e-8df5-4c19-8a06-d14e714cb74a"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "1872a165-e231-4bb2-b651-d1a9e16e905a",
"expectedRevision": 8,
"customerId": "bc49ac2e-8df5-4c19-8a06-d14e714cb74a"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'PATCH',
f'{os.environ["RDC_BASE_URL"]}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '1872a165-e231-4bb2-b651-d1a9e16e905a',
'expectedRevision': 8,
'customerId': 'bc49ac2e-8df5-4c19-8a06-d14e714cb74a',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "1872a165-e231-4bb2-b651-d1a9e16e905a",
"expectedRevision": 8,
"customerId": "bc49ac2e-8df5-4c19-8a06-d14e714cb74a"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
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.Patch, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "1872a165-e231-4bb2-b651-d1a9e16e905a",
"expectedRevision": 8,
"customerId": "bc49ac2e-8df5-4c19-8a06-d14e714cb74a"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "1872a165-e231-4bb2-b651-d1a9e16e905a",
"status": "accepted",
"aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"aggregateRevision": 9
} Pay by card
Pay in one of two ways from the same revision. The amount defaults to what is still due. The 202 means the reader of the till has the amount and waits for the card; the order is awaiting_payment and its lines no longer change. The reader gives the result: an approved card makes the order paid. A declined card stays on the order as a payment with the status declined, and the order stays awaiting_payment. See Split a payment and Card readers.
Start the card payment
curl
curl -X POST "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/card-payments" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "c7cf6a81-7fd8-4110-86fd-f6d153846cab",
"expectedRevision": 9,
"amount": "67.87"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/card-payments`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "c7cf6a81-7fd8-4110-86fd-f6d153846cab",
"expectedRevision": 9,
"amount": "67.87"
}),
});
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/card-payments',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'c7cf6a81-7fd8-4110-86fd-f6d153846cab',
'expectedRevision': 9,
'amount': '67.87',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "c7cf6a81-7fd8-4110-86fd-f6d153846cab",
"expectedRevision": 9,
"amount": "67.87"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/card-payments');
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/card-payments");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "c7cf6a81-7fd8-4110-86fd-f6d153846cab",
"expectedRevision": 9,
"amount": "67.87"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "c7cf6a81-7fd8-4110-86fd-f6d153846cab",
"status": "accepted",
"aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"aggregateRevision": 10
} Pay in cash
given is what the customer handed over. When it covers due, the order is paid and the change of the payment is the difference. Less than due makes the order partially_paid. Cash needs no network.
Take the cash
curl
curl -X POST "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/cash-payments" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "4c2abc63-3b7b-48f0-9c67-9e1a6f13e4ad",
"expectedRevision": 9,
"given": "70.00"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/cash-payments`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "4c2abc63-3b7b-48f0-9c67-9e1a6f13e4ad",
"expectedRevision": 9,
"given": "70.00"
}),
});
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/cash-payments',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '4c2abc63-3b7b-48f0-9c67-9e1a6f13e4ad',
'expectedRevision': 9,
'given': '70.00',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "4c2abc63-3b7b-48f0-9c67-9e1a6f13e4ad",
"expectedRevision": 9,
"given": "70.00"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/cash-payments');
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/cash-payments");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "4c2abc63-3b7b-48f0-9c67-9e1a6f13e4ad",
"expectedRevision": 9,
"given": "70.00"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "4c2abc63-3b7b-48f0-9c67-9e1a6f13e4ad",
"status": "accepted",
"aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
"aggregateRevision": 11
} {
"number": "Bon 1042",
"status": "paid",
"total": "67.87",
"paid": "67.87",
"due": "0.00",
"sync": "posted",
"revision": 11,
"payments": [
{
"method": "cash",
"status": "approved",
"amount": "67.87",
"given": "70.00",
"change": "2.13"
}
]
} What the statuses mean
| Status | Meaning |
|---|---|
open | Items and the customer can change. |
awaiting_payment | A payment has started. The lines are fixed. |
partially_paid | Part of the total is paid and the rest is due. |
paid | The total is paid. The units leave the shelf; the sale is posted, or queued when the till has no network. |
Events
The till sends order.paid when the order becomes paid, with the number, paidAt, the totals, the VAT of each rate, the lines and the approved payments. Each declined card sends payment.declined. See Event catalogue.
When a request is refused
| Code | HTTP | What to do |
|---|---|---|
out_of_stock | 422 | Lower the quantity or remove the line. onHand shows what is on the shelf. |
unknown_barcode | 422 | Look the item up with barcode on the list of items. |
invalid_quantity | 422 | Send a whole quantity of at least 1. |
discount_limit | 422 | Send a discount within the limit of the cashier profile. |
invalid_status | 422 | Lines and customer change only while the order is open. Read the order and use the operation that fits its status. |
empty_order | 422 | Add a line before payment starts. |
reader_busy | 422 | Wait for the card payment to end, or cancel it while the reader waits for the card. |
revision_conflict | 409 | Read the order again and send the change with a new operationId. |