Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Refund and void

    Void an order that has no payment, refund one that is paid: which statuses allow each, how the refund amount is worked out and what is refused.

    On this page

    Void an order that has no payment; refund one that is paid. A void ends the order. A refund adds a linked record to a paid order and never edits its payments.

    Void an unpaid order

    Voiding ends an order before any payment is taken. A declined card is not a payment taken: order Bon 1038 has one and was voided. When the order is the current order of the till, the till gets a new empty order.

    curl

    curl -X POST "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/void" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "544c56ff-8ff1-4a1a-a5ae-3809d22c0931",
      "expectedRevision": 5
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/void`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "544c56ff-8ff1-4a1a-a5ae-3809d22c0931",
        "expectedRevision": 5
      }),
    });
    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/void',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '544c56ff-8ff1-4a1a-a5ae-3809d22c0931',
            'expectedRevision': 5,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "544c56ff-8ff1-4a1a-a5ae-3809d22c0931",
      "expectedRevision": 5
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/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")}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/void");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "544c56ff-8ff1-4a1a-a5ae-3809d22c0931",
      "expectedRevision": 5
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "544c56ff-8ff1-4a1a-a5ae-3809d22c0931",
      "status": "accepted",
      "aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
      "aggregateRevision": 6
    }

    Status of the orderWhat `voidOrder` answers
    open, on_hold, awaiting_paymentThe order becomes voided.
    partially_paidpayments_taken: a payment is on the order. Refund it once it is paid.
    paid, refundedorder_paid: refund a paid order instead.
    voidedinvalid_status: the order is already voided.

    A void is also refused with reader_busy while the reader of the till is reading or authorising a card for the order, and with empty_order when the order has no lines.

    Refund a paid order

    Send the units as lines, the payment method to give the money back on as method, a reason and restock. restock true puts the units back on the shelf; use false for goods that cannot be sold again.

    The method must be one the customer paid by: order Bon 1041 was paid in cash, so it is refunded in cash, and the drawer must hold that cash. A refund needs the network and a sale that has been posted; see Work without network.

    curl

    curl -X POST "$RDC_BASE_URL/pos/v1/orders/2f3dc72e-67d0-42c7-9d92-98e4dac497d0/refunds" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "72bf144e-4a7b-4081-982e-1317d053dcb2",
      "expectedRevision": 3,
      "lines": [
        {
          "sku": "FA-0001",
          "quantity": "1"
        }
      ],
      "method": "cash",
      "reason": "damaged",
      "restock": false
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/2f3dc72e-67d0-42c7-9d92-98e4dac497d0/refunds`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "72bf144e-4a7b-4081-982e-1317d053dcb2",
        "expectedRevision": 3,
        "lines": [
          {
            "sku": "FA-0001",
            "quantity": "1"
          }
        ],
        "method": "cash",
        "reason": "damaged",
        "restock": false
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/pos/v1/orders/2f3dc72e-67d0-42c7-9d92-98e4dac497d0/refunds',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '72bf144e-4a7b-4081-982e-1317d053dcb2',
            'expectedRevision': 3,
            'lines': [
                {
                    'sku': 'FA-0001',
                    'quantity': '1',
                },
            ],
            'method': 'cash',
            'reason': 'damaged',
            'restock': False,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "72bf144e-4a7b-4081-982e-1317d053dcb2",
      "expectedRevision": 3,
      "lines": [
        {
          "sku": "FA-0001",
          "quantity": "1"
        }
      ],
      "method": "cash",
      "reason": "damaged",
      "restock": false
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/2f3dc72e-67d0-42c7-9d92-98e4dac497d0/refunds');
    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/2f3dc72e-67d0-42c7-9d92-98e4dac497d0/refunds");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "72bf144e-4a7b-4081-982e-1317d053dcb2",
      "expectedRevision": 3,
      "lines": [
        {
          "sku": "FA-0001",
          "quantity": "1"
        }
      ],
      "method": "cash",
      "reason": "damaged",
      "restock": false
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "72bf144e-4a7b-4081-982e-1317d053dcb2",
      "status": "accepted",
      "aggregateId": "2f3dc72e-67d0-42c7-9d92-98e4dac497d0",
      "aggregateRevision": 4
    }

    One of the 2 units of FA-0001 goes back and gives back 4.60. The order stays paid because a unit is left.

    How the amount is worked out

    The amount is a share of what the line cost after its discount, counted over all the units returned so far, never unit by unit. The parts of a full refund therefore add up to exactly what was paid. A line of 3 units with a discount of 7% costs 13.39:

    Unit returnedGiven back
    First4.46
    Second4.47
    Third4.46
    Whole line13.39

    Reasons

    Value of `reason`Meaning
    wrong_itemWrong item
    damagedDamaged
    changed_mindChanged mind
    price_errorPrice error

    Refunded or still paid

    A refund of some units leaves the order paid; the refund of the last unit makes it refunded. Bon 1039 is paid after 2 of its 6 units of AP-0101 went back (8.40, method card). Bon 1040 is refunded: every unit came back in one refund of 39.80, the whole price paid.

    curl

    curl "$RDC_BASE_URL/pos/v1/refunds?limit=20" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/refunds?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"]}/pos/v1/refunds?limit=20',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/refunds?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")}/pos/v1/refunds?limit=20");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "items": [
        {
          "id": "d81f9090-fcf3-48c3-9b67-a1ed7ded6ec3",
          "orderId": "3178a6cd-5034-4dd9-8bc9-7e1c238068bd",
          "lines": [
            {
              "sku": "AP-0101",
              "quantity": "2"
            }
          ],
          "amount": "8.40",
          "method": "card",
          "reason": "changed_mind",
          "restock": true,
          "at": "2026-11-23T06:58:00Z"
        }
      ],
      "nextCursor": null
    }

    Events

    order.voided is sent when an order is voided; its data has orderId, number and tillId. order.refunded is sent for every refund; its data has refundId, amount, method, reason, restock and the lines. See Event catalogue.

    When a refund is refused

    CodeHTTPWhat to do
    not_paid422Read the order and refund it once it is paid.
    nothing_to_refund422Every unit is already returned. Nothing to do.
    network_lost422Repeat the request when the till reports online.
    order_not_posted422Read the order and refund it when its sync is posted.
    method_not_used422Use a method of the payments of the order.
    exceeds_method422Split the refund between the methods of the order.
    quantity_exceeds_sold422Send at most the units left to return.
    reason_required422Send one of the values of the table of reasons.
    insufficient_cash422Refund by card, or add cash to the drawer first.