Skip to main content

Invoicing Inventory Movement via REST API

How to invoice a goods receipt or issue note using the API

Written by Petr Pech

Since version 2021.9, the REST API allows you to invoice a goods receipt or issue note — that is, to create a received or issued invoice from a stock document.


Calling method

The request is sent using the method POST or PUT to the evidence of the given invoice:

POST https://demo.flexibee.eu/c/demo/faktura-vydana.xml

In the invoice body, specify the fakturuj element with the following properties:

  • skladovyDokl — a required identifier of the stock document to be invoiced

  • prenestSlevu — an optional true value, if the discount from the order should be applied

⚠️ In the invoice body, specify only the required properties, such as typDokl, cisDosle, and datSplat. Other properties may be overwritten by data from the goods receipt or issue note. A non-existent stock document returns 400 with the code importXmlNotFoundForIdentifier.


Usage examples

Invoicing a goods receipt

<winstrom version="1.0">
<faktura-prijata>
<id>ext:FAP</id>
<typDokl>code:FAKTURA</typDokl>
<cisDosle>123</cisDosle>
<datSplat>2024-07-14</datSplat>
<fakturuj>
<skladovyDokl>ext:PRIJEMKA123</skladovyDokl>
</fakturuj>
</faktura-prijata>
</winstrom>

Invoicing an issue note

<winstrom version="1.0">
<faktura-vydana>
<id>ext:FAV</id>
<typDokl>code:FAKTURA</typDokl>
<fakturuj>
<skladovyDokl>ext:VYDEJ123</skladovyDokl>
</fakturuj>
</faktura-vydana>
</winstrom>

Invoicing an issue note with an order discount applied

<winstrom version="1.0">
<faktura-vydana>
<id>ext:FAV</id>
<typDokl>code:FAKTURA</typDokl>
<fakturuj>
<skladovyDokl>ext:VYDEJ123</skladovyDokl>
<prenestSlevu>true</prenestSlevu>
</fakturuj>
</faktura-vydana>
</winstrom>

The same in JSON

{
"winstrom": {
"@version": "1.0",
"faktura-vydana": {
"id": "ext:FAV",
"typDokl": "code:FAKTURA",
"fakturuj": {
"skladovyDokl": "ext:VYDEJ123"
}
}
}
}


Bulk invoicing of goods receipts and issue notes

The API also allows bulk invoicing — you can achieve this by repeating the call to the fakturuj service within a single request under the same external identifier of the invoice.

Example in JSON

Invoicing two stock receipts into a single received invoice, including accompanying information for the invoice:

{
"winstrom": {
"@version": "1.0",
"faktura-prijata": [
{
"id": "ext:ESHOP:1234",
"typDokl": "code:FAKTURA",
"firma": "641",
"datVyst": "2024-09-16",
"duzpPuv": "2024-09-16",
"datSplat": "2024-09-30",
"duzpUcto": "2024-09-16",
"varSym": "703000106",
"szbDphSniz": 12.0,
"szbDphZakl": 21.0,
"formaUhradyCis": "code:HOTOVĚ",
"cisDosle": "1",
"fakturuj": {
"skladovyDokl": "1",
"prenestSlevu": true
}
},
{
"id": "ext:ESHOP:1234",
"fakturuj": {
"skladovyDokl": "2",
"prenestSlevu": true
}
},
{
"id": "ext:ESHOP:1234",
"@removeExternalIds": "ext:ESHOP",
"fakturuj": {
"skladovyDokl": "3",
"prenestSlevu": true
}
}
]
}
}

Example in XML

<?xml version="1.0" encoding="UTF-8" ?>
<winstrom version="1.0">
<faktura-prijata>
<id>ext:ESHOP:1234</id>
<typDokl>code:FAKTURA</typDokl>
<firma>641</firma>
<datVyst>2024-09-16</datVyst>
<duzpPuv>2024-09-16</duzpPuv>
<datSplat>2024-09-30</datSplat>
<duzpUcto>2024-09-16</duzpUcto>
<varSym>1</varSym>
<cisDosle>1</cisDosle>
<fakturuj>
<skladovyDokl>1</skladovyDokl>
<prenestSlevu>true</prenestSlevu>
</fakturuj>
</faktura-prijata>
<faktura-prijata>
<id>ext:ESHOP:1234</id>
<fakturuj>
<skladovyDokl>2</skladovyDokl>
<prenestSlevu>true</prenestSlevu>
</fakturuj>
</faktura-prijata>
<faktura-prijata removeExternalIds="ext:ESHOP">
<id>ext:ESHOP:1234</id>
<fakturuj>
<skladovyDokl>3</skladovyDokl>
<prenestSlevu>true</prenestSlevu>
</fakturuj>
</faktura-prijata>
</winstrom>

ℹ️ The external identifier in the last block is removed using the removeExternalIds attribute, or the @removeExternalIds property in JSON. Without this, the invoice would remain linked to the external identifier ext:ESHOP:1234, and the next bulk call would find and modify it.


Related

Did this answer your question?