Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Weights and produce codes

    How the bagging scale confirms a line, what happens when the weight differs and how an item sold by weight is priced.

    On this page

    The bagging scale is how a lane knows that what was scanned is what was bagged. After each scan the lane waits for a weight. You report what the scale carries now, in whole grams: the bag, every counted line and the new item. The system takes the change since the last counted line and compares it with the item.

    A packaged item

    A packaged item has the weight it should have and a tolerance, both set in the catalogue of the store. The line is counted when the change is within the tolerance. Otherwise the lane stops.

    curl

    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

    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

    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
    
    $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#

    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

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

    When the weight differs

    The request that reports a weight that differs is accepted, because the report is true. The lane moves to assistance_needed and an intervention with the reason weight_differs carries expectedGrams and measuredGrams.

    The intervention of a bottle that weighs too much

    {
      "reason": "weight_differs",
      "status": "waiting",
      "expectedGrams": 930,
      "measuredGrams": 1320
    }

    • An attendant who approves counts the weight that was measured as the weight of the line.
    • An attendant who refuses removes the line. The shopper takes the item off the scale and scans again.
    • An approval is refused with nothing_on_scale when the scale read no change at all: nothing was put on it, so there is nothing to count.

    An item sold by weight

    Fruit and vegetables have no weight to match. The change on the scale is the weight of the line, from 10 g. The amount of the line is that weight times the price per kilogram, rounded half up to the ban: 725 g at 6.99 per kilogram is 5.07. The code is the produce code of the item, typed or looked up by the shopper, not a scanned label.

    A weighed line

    {
      "code": "101",
      "sku": "MR-0001",
      "name": "Apples, per kg",
      "kind": "produce",
      "status": "active",
      "grams": 725,
      "unitPrice": "6.99",
      "vatRate": "11",
      "total": "5.07",
      "ageApprovedBy": null
    }

    A weight that is not a whole number of grams is refused with invalid_weight. A weight when no line waits for one is refused with no_weight_expected.