Open a basket and add lines
Open a basket on a free lane, add what the scanner reads, declare an own bag and take a line back.
On this page
A basket is opened on a lane that is idle. The lane then takes one line at a time: each scan adds a line, and the next scan waits until the weight of that line is reported.
Open the basket
curl
curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
"laneId": "93745be9-35d3-4b71-a2a6-dfcafee63996"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
"laneId": "93745be9-35d3-4b71-a2a6-dfcafee63996"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '883b7e9e-7568-4828-b17c-faba4746e348',
'laneId': '93745be9-35d3-4b71-a2a6-dfcafee63996',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
"laneId": "93745be9-35d3-4b71-a2a6-dfcafee63996"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets');
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")}/selfcheckout/v1/baskets");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
"laneId": "93745be9-35d3-4b71-a2a6-dfcafee63996"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
"status": "accepted",
"aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
"aggregateRevision": 1
} | Refused with | Code | Why |
|---|---|---|
409 | lane_not_idle | The lane already has a basket. |
409 | lane_out_of_service | The lane is closed or a device is in fault. |
404 | lane_not_found | The lane is not in your account. |
Declare an own bag
A shopper who brings a bag puts it on the scale first. Send its weight before the first line. The scale then expects the bag as well as the items, so the bag is not mistaken for an item.
curl
curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
"expectedRevision": 1,
"grams": 85
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
"expectedRevision": 1,
"grams": 85
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'e6779957-8d26-49ab-bdb4-3916a13a3c57',
'expectedRevision': 1,
'grams': 85,
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
"expectedRevision": 1,
"grams": 85
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag');
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")}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
"expectedRevision": 1,
"grams": 85
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
"status": "accepted",
"aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
"aggregateRevision": 2
} A bag lighter than 20 g or heavier than 1500 g is refused with invalid_weight. A second bag is refused with own_bag_declared, and a bag after the first line with own_bag_too_late.
Add a line
Send the eight digits the scanner read. For an item sold by weight, send the produce code that the shopper typed or looked up. Each scan is one piece and one line; scan a second bottle and you get a second line.
curl
curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/lines" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
"expectedRevision": 1,
"code": "20101015"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/lines`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
"expectedRevision": 1,
"code": "20101015"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/lines',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'd1941539-061a-404d-bd69-d2c545eb92f0',
'expectedRevision': 1,
'code': '20101015',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
"expectedRevision": 1,
"code": "20101015"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/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")}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/lines");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
"expectedRevision": 1,
"code": "20101015"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
"status": "accepted",
"aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
"aggregateRevision": 2
} | Status | Meaning |
|---|---|
| The line waits for the weight of the bagging scale. | |
| The item is age-restricted. An age check waits for an attendant. | |
| The line is counted in the total. | |
| The line was removed. It stays in the basket and is not counted. |
Take a line back
An attendant voids a line of an open basket. The weight of a counted line leaves the scale, and an intervention that waited on the line is closed as voided.
curl
curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
"expectedRevision": 6,
"attendantId": "cristina-lungu"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
"expectedRevision": 6,
"attendantId": "cristina-lungu"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'c190d5af-edff-47bd-85e5-099fd3de3306',
'expectedRevision': 6,
'attendantId': 'cristina-lungu',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
"expectedRevision": 6,
"attendantId": "cristina-lungu"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void');
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")}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
"expectedRevision": 6,
"attendantId": "cristina-lungu"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
"status": "accepted",
"aggregateId": "c37612e6-3f10-4a7d-b962-2afad36a4ab8",
"aggregateRevision": 7
} Read the lines with listLines: they come in the order they were scanned, voided ones included.
curl
curl "$RDC_BASE_URL/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20`, {
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"]}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20');
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")}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"items": [
{
"id": "7befa6fb-9f93-4bda-a605-9779f9d33f2a",
"code": "20101015",
"sku": "PN-0101",
"name": "White bread, 500 g",
"kind": "packaged",
"status": "active",
"grams": 520,
"unitPrice": "4.90",
"vatRate": "11",
"total": "4.90",
"ageApprovedBy": null
},
{
"id": "57120a70-28dc-4ed0-bc26-64b21accb7b2",
"code": "101",
"sku": "MR-0001",
"name": "Apples, per kg",
"kind": "produce",
"status": "active",
"grams": 720,
"unitPrice": "6.99",
"vatRate": "11",
"total": "5.03",
"ageApprovedBy": null
},
{
"id": "9cd3606d-0f2c-403e-af96-d862f58c03e0",
"code": "102",
"sku": "BN-0002",
"name": "Bananas, per kg",
"kind": "produce",
"status": "active",
"grams": 540,
"unitPrice": "7.99",
"vatRate": "11",
"total": "4.31",
"ageApprovedBy": null
}
],
"nextCursor": null
}