---
title: "Scanner and scale events | Docs | Self-Checkout by R&D Copilot"
description: "What the scanner and the bagging scale send, in which order, and what the system answers."
canonical: "https://checkout.rdcopilot.com/docs/devices/scanner-and-scale-events/"
language: en
updated: 2026-11-22
---

# Scanner and scale events

What the scanner and the bagging scale send, in which order, and what the system answers.

The scanner and the bagging scale of a lane work as a pair. The scanner reads a code and sends `addLine`. The scale then reports what it carries and sends `recordWeight`. The lane does not take the next scan until the weight is in.

| Device | Sends | What it carries |
| --- | --- | --- |
| `scanner` | `addLine` | The eight digits of a packaged item, or the produce code that the shopper typed or looked up. |
| `scale` | `recordWeight` | The weight the scale carries now, in whole grams: the bag, every counted line and the new item. |
| `scale` | `useOwnBag` | The weight of an own bag put on the scale before the first scan. |

## The order of one item

1.  Scan
    
    `addLine`. The lane is `weight_pending`.
    
2.  Weigh
    
    `recordWeight`. The line is counted and the lane is `scanning`, or the lane stops with `weight_differs`.
    
3.  Next scan
    
    Only now. A scan before the weight is refused with `weight_pending`.
    

curl

```bash
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

```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

```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
<?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#

```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/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();
```

Response 202

```json
{
  "operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
  "status": "accepted",
  "aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
  "aggregateRevision": 2
}
```

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": "42fe2ea0-c3f6-4500-9ac8-79c51d303864",
  "expectedRevision": 2,
  "grams": 526
}'
```

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": "42fe2ea0-c3f6-4500-9ac8-79c51d303864",
    "expectedRevision": 2,
    "grams": 526
  }),
});
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': '42fe2ea0-c3f6-4500-9ac8-79c51d303864',
        'expectedRevision': 2,
        'grams': 526,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "42fe2ea0-c3f6-4500-9ac8-79c51d303864",
  "expectedRevision": 2,
  "grams": 526
}
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": "42fe2ea0-c3f6-4500-9ac8-79c51d303864",
  "expectedRevision": 2,
  "grams": 526
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "42fe2ea0-c3f6-4500-9ac8-79c51d303864",
  "status": "accepted",
  "aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
  "aggregateRevision": 3
}
```

## A code the store does not know

A code that matches no item is refused with `code_not_found` and nothing changes: the lane stays `scanning`, so the shopper can scan again or look the item up.

A scale that sends a weight with nothing on it gets the answer `202`, then an intervention with `measuredGrams` of `0`. An attendant cannot approve it, only refuse it or void the line.
