Sales documents
Order → invoice → receipt flow
1. Adding an order
Python
order_payload = {
'PartnerId': 27501,
'Date': '2026-05-13',
'Currency': 'RON',
'Lines': [
{'ArticleCode': '0000002', 'Quantity': 1, 'UnitPrice': 4500.00, 'VATRateId': 1, 'WarehouseId': 1},
{'ArticleCode': '0000003', 'Quantity': 1, 'UnitPrice': 89.00, 'VATRateId': 1, 'WarehouseId': 1}
]
}
order = nx_call(token, 'AddSaleOrder', order_payload)
print(order) # {'Id': 9101, 'Number': 'COM-000556'}
2. Generating an invoice from the order
Node.js
const invoice = await client._call('AddSaleInvoice', {
PartnerId: 27501,
Date: '2026-05-13',
Currency: 'RON',
Lines: order.Lines // reuse the order lines
});
Stock validation
AddSaleInvoice checks stock if the line contains WarehouseId + ArticleCode. Insufficient stock → Stoc insuficient pentru ...
3. Recording a receipt
PHP
$receipt = nx_call($token, 'SaveReceiptWithoutMarking', [
'PartnerId' => 27501,
'Value' => 4589.00,
'Currency' => 'RON'
]);
// ['Id' => 3001, 'Number' => 'CHI-000413']
4. Settling the receipt against the invoice
cURL
curl -X POST http://localhost:4000/NextUpServices/Services/POST/ \
-H "Content-Type: text/plain" \
-d "{
\"AuthenticationToken\":\"$NX_TOKEN\",
\"Method\":\"PayDocumentsWithReceipt\",
\"Params\":{\"ReceiptId\": 3001, \"DocumentIds\": [7101]}
}"
Reversing an invoice
Node.js
const storno = await client._call('StornoSaleInvoice', { Id: 7001 });
// { Id: 7102, Number: 'FAC-S-001025' } -- a negative invoice
Sending an invoice by e-mail
Python
ok = nx_call(token, 'SendDocumentToEmail', {'Id': 7001, 'Email': 'client@example.com'})
# True