Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Split a payment

    Pay one order with cash and card: the part payments, the amount and given fields, where the change goes, and what a declined card leaves on the order.

    On this page

    A payment can be split between methods. Each part is its own payment on the order, and the order is partially_paid until the parts add up to the total. This guide follows Bon 1037, 39.70: cash first, then the rest by card.

    Cash first, then the rest by card

    Take the cash the customer hands over, 15.00. It is less than the total, so the order becomes partially_paid with 24.70 due.

    Take the cash part

    curl

    curl -X POST "$RDC_BASE_URL/pos/v1/orders/bc0ba299-ab00-4491-9d89-818cfeb93543/cash-payments" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "441b6167-8ea6-41a5-9152-48ff3f3e3c9e",
      "expectedRevision": 4,
      "given": "15.00"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/bc0ba299-ab00-4491-9d89-818cfeb93543/cash-payments`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "441b6167-8ea6-41a5-9152-48ff3f3e3c9e",
        "expectedRevision": 4,
        "given": "15.00"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/pos/v1/orders/bc0ba299-ab00-4491-9d89-818cfeb93543/cash-payments',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '441b6167-8ea6-41a5-9152-48ff3f3e3c9e',
            'expectedRevision': 4,
            'given': '15.00',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "441b6167-8ea6-41a5-9152-48ff3f3e3c9e",
      "expectedRevision": 4,
      "given": "15.00"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/bc0ba299-ab00-4491-9d89-818cfeb93543/cash-payments');
    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/bc0ba299-ab00-4491-9d89-818cfeb93543/cash-payments");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "441b6167-8ea6-41a5-9152-48ff3f3e3c9e",
      "expectedRevision": 4,
      "given": "15.00"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "441b6167-8ea6-41a5-9152-48ff3f3e3c9e",
      "status": "accepted",
      "aggregateId": "bc0ba299-ab00-4491-9d89-818cfeb93543",
      "aggregateRevision": 6
    }

    Start the card for the rest. amount is what the card takes; leave it out and it is what is still due, and more than that is refused with amount_exceeds_due. The reader waits for the card, and an approved card completes the order.

    Start the card part

    curl

    curl -X POST "$RDC_BASE_URL/pos/v1/orders/bc0ba299-ab00-4491-9d89-818cfeb93543/card-payments" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "6bc0517c-4d7c-4c47-a1a0-437f55678968",
      "expectedRevision": 6,
      "amount": "24.70"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/bc0ba299-ab00-4491-9d89-818cfeb93543/card-payments`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "6bc0517c-4d7c-4c47-a1a0-437f55678968",
        "expectedRevision": 6,
        "amount": "24.70"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/pos/v1/orders/bc0ba299-ab00-4491-9d89-818cfeb93543/card-payments',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '6bc0517c-4d7c-4c47-a1a0-437f55678968',
            'expectedRevision': 6,
            'amount': '24.70',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "6bc0517c-4d7c-4c47-a1a0-437f55678968",
      "expectedRevision": 6,
      "amount": "24.70"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/bc0ba299-ab00-4491-9d89-818cfeb93543/card-payments');
    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/bc0ba299-ab00-4491-9d89-818cfeb93543/card-payments");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "6bc0517c-4d7c-4c47-a1a0-437f55678968",
      "expectedRevision": 6,
      "amount": "24.70"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "6bc0517c-4d7c-4c47-a1a0-437f55678968",
      "status": "accepted",
      "aggregateId": "bc0ba299-ab00-4491-9d89-818cfeb93543",
      "aggregateRevision": 6
    }

    The order is paid: 39.70 paid, nothing due. Read the payments of the order, each with its method, its amount and, for a card, the brand, the last four digits and the authorisation code.

    curl

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

    JavaScript

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

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/payments?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/payments?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": "66f19c8c-2ef9-4f4e-845d-d2fddadf5f63",
          "orderId": "bc0ba299-ab00-4491-9d89-818cfeb93543",
          "method": "card",
          "status": "approved",
          "amount": "24.70",
          "given": null,
          "change": null,
          "card": {
            "brand": "visa",
            "last4": "6139",
            "entry": "contactless",
            "authCode": "327949",
            "declineReason": null
          },
          "at": "2026-11-23T06:35:10Z"
        },
        {
          "id": "2184b315-aeb9-4e41-b046-27b1f0e78338",
          "orderId": "bc0ba299-ab00-4491-9d89-818cfeb93543",
          "method": "cash",
          "status": "approved",
          "amount": "15.00",
          "given": "15.00",
          "change": "0.00",
          "card": null,
          "at": "2026-11-23T06:34:40Z"
        }
      ],
      "nextCursor": null
    }

    Card first, then cash

    The other way round uses the same two requests. Start the card with an amount below the total, then take the rest in cash.

    RequestOrder after it
    startCardPayment with amount 20.00partially_paid, 19.70 due
    takeCashPayment with given 20.00paid; the cash payment has amount 19.70 and change 0.30

    A declined card

    A declined attempt stays on the order as a payment with status declined, the reason in card.declineReason and the amount it asked for. It settles nothing: paid and due do not change. The reader is declined and the order keeps its status, so the customer has three ways on. Bon 1042 meets a declined card and then an approved one:

    The card payments of Bon 1042

    [
      {
        "status": "declined",
        "amount": "61.95",
        "card": {
          "brand": "mastercard",
          "last4": "9204",
          "entry": "contactless",
          "authCode": null,
          "declineReason": "insufficient_funds"
        }
      },
      {
        "status": "approved",
        "amount": "61.95",
        "card": {
          "brand": "visa",
          "last4": "4417",
          "entry": "contactless",
          "authCode": "731818",
          "declineReason": null
        }
      }
    ]

    RequestReaderOrder
    retryCardPaymentwaitingUnchanged: awaiting_payment, or partially_paid when a part is paid.
    cancelCardPaymentcancelledBack to open, or to partially_paid when a part is paid.
    takeCashPaymentidlepaid, or partially_paid when the cash is less than what is due.

    curl

    curl -X POST "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/card-payments/retry" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "691e7778-6b81-4305-89d7-a9146efd7ee1",
      "expectedRevision": 7
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/card-payments/retry`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "691e7778-6b81-4305-89d7-a9146efd7ee1",
        "expectedRevision": 7
      }),
    });
    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/card-payments/retry',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '691e7778-6b81-4305-89d7-a9146efd7ee1',
            'expectedRevision': 7,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "691e7778-6b81-4305-89d7-a9146efd7ee1",
      "expectedRevision": 7
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/card-payments/retry');
    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/card-payments/retry");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "691e7778-6b81-4305-89d7-a9146efd7ee1",
      "expectedRevision": 7
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "691e7778-6b81-4305-89d7-a9146efd7ee1",
      "status": "accepted",
      "aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
      "aggregateRevision": 7
    }

    curl

    curl -X POST "$RDC_BASE_URL/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/card-payments/cancel" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "7d83da7d-aa63-4fbd-9fbb-ca0014ea1d8f",
      "expectedRevision": 7
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/card-payments/cancel`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "7d83da7d-aa63-4fbd-9fbb-ca0014ea1d8f",
        "expectedRevision": 7
      }),
    });
    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/card-payments/cancel',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '7d83da7d-aa63-4fbd-9fbb-ca0014ea1d8f',
            'expectedRevision': 7,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "7d83da7d-aa63-4fbd-9fbb-ca0014ea1d8f",
      "expectedRevision": 7
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/pos/v1/orders/9d8c072d-afa0-4272-97ab-4443d54d5b62/card-payments/cancel');
    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/card-payments/cancel");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "7d83da7d-aa63-4fbd-9fbb-ca0014ea1d8f",
      "expectedRevision": 7
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "7d83da7d-aa63-4fbd-9fbb-ca0014ea1d8f",
      "status": "accepted",
      "aggregateId": "9d8c072d-afa0-4272-97ab-4443d54d5b62",
      "aggregateRevision": 8
    }

    Events

    Every declined card sends payment.declined. A part payment sends no event; order.paid is sent once, when the last part completes the order. See Event catalogue.

    When a request is refused

    CodeHTTPWhat to do
    amount_exceeds_due422Send at most the amount still due, or leave out amount.
    invalid_amount422Send an amount or a given above zero.
    reader_busy422Wait for the payment to end, or cancel it while the reader waits for the card.
    no_declined_card422Start a card payment instead of retrying.
    no_card_payment422Read the till to see the state of its reader.
    network_lost422Take cash, or repeat the request when the till reports online.
    out_of_stock422The shelf is checked again when payment starts. Lower the quantity or remove the line.