---
title: "Take an order to delivery | Docs | ERP by R&D Copilot"
description: "Confirm a sales order, reserve stock, handle a line that is short, deliver and invoice."
canonical: "https://erp.rdcopilot.com/docs/guides/take-an-order-to-delivery/"
language: en
updated: 2026-11-22
---

# Take an order to delivery

Confirm a sales order, reserve stock, handle a line that is short, deliver and invoice.

This guide goes from a draft order to an invoice and shows what to do at the two points where an order can stop: the credit check and a short line. The calls are in the [Quickstart](https://erp.rdcopilot.com/docs/get-started/quickstart/); here is what each answer means.

## Confirm

`confirmSalesOrder` adds the order to the unpaid invoices of the customer and compares the sum with the `creditLimit` of the partner. Within the limit the order becomes `confirmed`. Over it, the call answers 409 with `credit_limit_exceeded` and the order stays a draft with nothing changed.

1.  Read the customer
    
    `GET /partners/{partnerId}` returns `creditLimit` and `paymentTermsDays`.
    
2.  Record the payments that came in
    
    A payment on an invoice lowers the balance that counts against the limit. See [Taxes and rounding](https://erp.rdcopilot.com/docs/concepts/taxes-and-rounding/) for the amounts.
    
3.  Confirm again
    
    Send the same order with a new `operationId` and the revision you read.
    

## Reserve

`reserveSalesOrder` sets aside, line by line, as much as is free in stock: the `available` of the item. When every line is covered the order becomes `reserved`. Otherwise it stays `confirmed`, the lines keep what they got in `reserved`, and `short` says how many units each line still wants.

An order with a short line

curl

```bash
curl "$RDC_BASE_URL/erp/v1/sales-orders/58bf36f0-7c9a-403c-9e37-b0f51ed4ba8a" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/sales-orders/58bf36f0-7c9a-403c-9e37-b0f51ed4ba8a`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/sales-orders/58bf36f0-7c9a-403c-9e37-b0f51ed4ba8a',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/sales-orders/58bf36f0-7c9a-403c-9e37-b0f51ed4ba8a');
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#

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

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/sales-orders/58bf36f0-7c9a-403c-9e37-b0f51ed4ba8a");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "id": "58bf36f0-7c9a-403c-9e37-b0f51ed4ba8a",
  "number": "CV-1044",
  "customerId": "fb5a17a6-4534-43fd-aa84-0db4e3035003",
  "customerName": "Pensiunea Stânca Corbului SRL",
  "date": "2026-11-20",
  "status": "confirmed",
  "lines": [
    {
      "code": "FA-0010",
      "name": "White flour, 10 kg bag",
      "quantity": "40",
      "unit": "bag",
      "unitPrice": "38.90",
      "vatRate": "11",
      "net": "1556.00",
      "reserved": "36",
      "short": "4"
    },
    {
      "code": "DT-0412",
      "name": "Dishwashing liquid, 5 l",
      "quantity": "6",
      "unit": "canister",
      "unitPrice": "23.47",
      "vatRate": "21",
      "net": "140.82",
      "reserved": "6",
      "short": "0"
    },
    {
      "code": "AM-0518",
      "name": "Paper bags, pack of 100",
      "quantity": "4",
      "unit": "pack",
      "unitPrice": "13.13",
      "vatRate": "21",
      "net": "52.52",
      "reserved": "4",
      "short": "0"
    }
  ],
  "net": "1749.34",
  "vat": "211.76",
  "total": "1961.10",
  "vatBreakdown": [
    {
      "rate": "11",
      "base": "1556.00",
      "vat": "171.16"
    },
    {
      "rate": "21",
      "base": "193.34",
      "vat": "40.60"
    }
  ],
  "currency": "RON",
  "deliveryId": null,
  "deliveryNumber": null,
  "invoiceId": null,
  "invoiceNumber": null,
  "revision": 3
}
```

The first line asked for 40 bags and 36 were free: it has `reserved` 36 and `short` 4. The order is still `confirmed`, and `createDelivery` would be refused with `wrong_status`.

## When a line is short

Reserving again while nothing more is free is refused with `nothing_to_reserve`. Read the item to see why, and decide what to buy:

The flour after the reservation

curl

```bash
curl "$RDC_BASE_URL/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c');
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#

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

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/items/1f30c60b-f896-443e-9086-2e72ab3dcc3c");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 200

```json
{
  "id": "1f30c60b-f896-443e-9086-2e72ab3dcc3c",
  "code": "FA-0010",
  "name": "White flour, 10 kg bag",
  "unit": "bag",
  "unitPrice": "38.90",
  "vatClass": "reduced",
  "vatRate": "11",
  "cost": "32.50",
  "made": false,
  "onHand": "36",
  "reserved": "36",
  "available": "0",
  "incoming": "0"
}
```

| Field | What it tells you |
| --- | --- |
| `available` | Nothing is free: all 36 units are reserved. |
| `incoming` | Nothing is on its way: no open purchase order has flour. |

The units to buy are the `short` of the order, less the `incoming` of the item, less what other confirmed orders will take. Place a purchase order for them and receive it: [Buy and receive goods](https://erp.rdcopilot.com/docs/guides/buy-and-receive-goods/). After the receipt, reserve again. The order takes the units that arrived and becomes `reserved`.

## Deliver and invoice

-   `createDelivery` takes the revision of the order (after the reservation in the quickstart it is 3). The reserved units leave `onHand` and `reserved` together, so `available` does not move.
-   `createInvoice` issues the invoice of a `delivered` order. The due date is the issue date plus the `paymentTermsDays` of the customer.
-   Each call is repeated safely with the same `operationId`; a call that arrives after another change is refused with `revision_conflict`.
