Skip to main content

Billing of Inventory Movements via REST API

How to Invoice a Goods Receipt or Goods Issue Using the API

Written by Petr Pech

Via the REST API, it is possible to invoice a goods receipt or goods issue starting from version 2021.9.

When creating an invoice, it is necessary to include the skladovyDokl field to identify the stock document type. Optionally, you can include prenestSlevu with the value true if the discount from the order should be applied.

Request Method

Requests are sent using the POST or PUT method to the relevant invoice record, for example:

Usage Examples

Invoicing a Goods Receipt

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

Invoicing a Goods Issue

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

Invoicing a Goods Issue with 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>

JSON Example

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

Bulk Invoicing of Goods Receipts / Goods Issues

The API also supports bulk invoicing. Bulk invoicing is achieved by repeating calls to the fakturuj service.

JSON Example

An example of invoicing two stock receipts into a single purchase invoice, including accompanying invoice information:

{
"winstrom": {
"faktura-prijata": [
{
"id": "ext:ESHOP:1234",
"typDokl": "code:FAKTURA",
"firma": "641",
"datVyst": "2022-09-16",
"duzpPuv": "2022-09-16",
"datSplat": "2022-09-30",
"duzpUcto": "2022-09-16",
"varSym": "703000106",
"szbDphSniz": 15.0,
"szbDphSniz2": 0.0,
"szbDphZakl": 21.0,
"formaUhradyCis": "code:HOTOVĚ",
"uvodTxt": "XXX",
"popis": "",
"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
}
}
],
"@version": "1.0"
}
}

XML Example

<?xml version="1.0" encoding="UTF-8" ?>
<winstrom version='1.0'>
<faktura-prijata>
<id>ext:ESHOP:1234</id>
<typDokl>10</typDokl>
<firma>641</firma>
<datVyst>2022-09-16</datVyst>
<duzpPuv>2022-09-16</duzpPuv>
<datSplat>2022-09-30</datSplat>
<duzpUcto>2022-09-16</duzpUcto>
<varSym>1</varSym>
<popis></popis>
<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>
Did this answer your question?