---
title: "Lane simulator in the test environment | Docs | Self-Checkout by R&D Copilot"
description: "Drive the lanes and the devices of the test store by request: scan, weigh, pay, break a device and watch the lane stop."
canonical: "https://checkout.rdcopilot.com/docs/get-started/lane-simulator/"
language: en
updated: 2026-11-22
---

# Lane simulator in the test environment

Drive the lanes and the devices of the test store by request: scan, weigh, pay, break a device and watch the lane stop.

The test company has a store with lanes whose scanner, bagging scale, card reader and printer you drive yourself. A device is a caller of the API: the scanner sends `addLine`, the scale sends `recordWeight`, the card reader sends `recordPayment` and every device sends `reportHeartbeat`. In the test environment you send those requests in their place, so you can run every path of a lane without a real lane.

## Paths to run

| To see | Send | The lane then is |
| --- | --- | --- |
| A clean basket | `openBasket`, `addLine`, `recordWeight` with the weight of the item, `startPayment`, `recordPayment` with `approved` | `complete` |
| A weight that differs | `recordWeight` with a weight far from the weight of the item | `assistance_needed` |
| An age check | `addLine` with the code of wine or beer | `assistance_needed` |
| A declined card | `recordPayment` with `declined`, three times | `assistance_needed` |
| A device that fails | `reportHeartbeat` with a `fault` | `out_of_service` |
| An endpoint that does not answer | Register a subscription: the first deliveries fail until `checkEndpoint` has run twice | — |

## A weight that differs

Add the oil of the test catalogue, then report a weight that is far from the weight of a bottle. The lane stops and an intervention carries the weight it expected and the weight it measured.

Report a weight that differs

curl

```bash
curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/weight" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "5d9a197a-bef5-444a-8fa3-5dd54ac9177f",
  "expectedRevision": 2,
  "grams": 1320
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/weight`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "5d9a197a-bef5-444a-8fa3-5dd54ac9177f",
    "expectedRevision": 2,
    "grams": 1320
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/weight',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '5d9a197a-bef5-444a-8fa3-5dd54ac9177f',
        'expectedRevision': 2,
        'grams': 1320,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "5d9a197a-bef5-444a-8fa3-5dd54ac9177f",
  "expectedRevision": 2,
  "grams": 1320
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/weight');
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#

```csharp
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/weight");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "5d9a197a-bef5-444a-8fa3-5dd54ac9177f",
  "expectedRevision": 2,
  "grams": 1320
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "5d9a197a-bef5-444a-8fa3-5dd54ac9177f",
  "status": "accepted",
  "aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
  "aggregateRevision": 3
}
```

The request is accepted, because the report is true: the scale carries that weight. The intervention that the lane raised carries both weights and waits for an attendant.

The intervention

```json
{
  "id": "86f851ad-36c7-49ea-b307-423ffb4c1af1",
  "storeId": "5c15af2a-ec60-41c3-b91c-db5b305b4fd1",
  "laneId": "93745be9-35d3-4b71-a2a6-dfcafee63996",
  "basketId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
  "lineId": "ce206d16-fd22-424a-8a27-578c9ca4a9f2",
  "reason": "weight_differs",
  "status": "waiting",
  "expectedGrams": 930,
  "measuredGrams": 1320,
  "raisedAt": "2026-11-23T07:13:00Z",
  "decidedAt": null,
  "decidedBy": null,
  "revision": 1
}
```

## A device that fails

Report a fault for a device. The lane goes out of service at once, an open basket is voided and the event `device.faulted` is sent. A report without a fault clears the fault, and an attendant opens the lane again.

Report a fault

curl

```bash
curl -X POST "$RDC_BASE_URL/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
  "fault": "paper_out"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
    "fault": "paper_out"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'a2930ef4-ba94-4886-9309-32e47ae150c8',
        'fault': 'paper_out',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
  "fault": "paper_out"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat');
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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
  "fault": "paper_out"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
  "status": "accepted",
  "aggregateId": "73bdccc0-4479-426a-b241-aeaf02cac7dc",
  "aggregateRevision": 2
}
```

Read the lane to see it: its `state` is `out_of_service`. Send the heartbeat again with `fault` set to `null`, then open the lane.

curl

```bash
curl -X POST "$RDC_BASE_URL/selfcheckout/v1/lanes/4c6a20f7-ddb2-473f-8e09-e73b9799e9c6/open" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "d3e52a44-b34f-4d85-b40a-6624821065c8",
  "expectedRevision": 1,
  "attendantId": "cristina-lungu"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/lanes/4c6a20f7-ddb2-473f-8e09-e73b9799e9c6/open`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "d3e52a44-b34f-4d85-b40a-6624821065c8",
    "expectedRevision": 1,
    "attendantId": "cristina-lungu"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/lanes/4c6a20f7-ddb2-473f-8e09-e73b9799e9c6/open',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'd3e52a44-b34f-4d85-b40a-6624821065c8',
        'expectedRevision': 1,
        'attendantId': 'cristina-lungu',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "d3e52a44-b34f-4d85-b40a-6624821065c8",
  "expectedRevision": 1,
  "attendantId": "cristina-lungu"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/lanes/4c6a20f7-ddb2-473f-8e09-e73b9799e9c6/open');
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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/selfcheckout/v1/lanes/4c6a20f7-ddb2-473f-8e09-e73b9799e9c6/open");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "d3e52a44-b34f-4d85-b40a-6624821065c8",
  "expectedRevision": 1,
  "attendantId": "cristina-lungu"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "d3e52a44-b34f-4d85-b40a-6624821065c8",
  "status": "accepted",
  "aggregateId": "4c6a20f7-ddb2-473f-8e09-e73b9799e9c6",
  "aggregateRevision": 2
}
```

The test company is reset to the same starting state when you ask our team. Records you create in it are not copied to live.
