Skip to main content

Credit Notes

How to credit invoices using the REST API?

Written by Lenka Haringerová

Linking a Credit Note to an Invoice

<?xml version="1.0"?>
<winstrom version="1.0">
<faktura-vydana>
<!-- dobropis; může být i "faktura-prijata" -->
<id>code:DOBROPIS1</id>
<!-- lze normálně uvést další vlastnosti dokladu jako při běžném importu -->
<vytvor-vazbu-dobropis>
<dobropisovanyDokl>code:FAKTURA1</dobropisovanyDokl>
<!-- identifikátor dobropisovaného dokladu-->
</vytvor-vazbu-dobropis>
</faktura-vydana>
</winstrom>

You can specify the ID of the invoiced document being credited (tag <dobropisovanyDokl> ) according to the standard rules. If the invoice is not found, the import will end with an error.

A single credit note can only be linked to one invoice. However, multiple credit notes can be linked to a single invoice. If a credit note is already linked to an invoice and an attempt is made to link it to a different one, the import will end with an error.

Important notes regarding the procedure above

  • The service creates only the link — the credit note document must have its line items correctly set up.

  • The created link adds only a header-level connection between documents; it does not handle line item linking.

  • The purchase price specified on the line items should correspond to the stock price of the goods from the credited document; otherwise, the stock balance will not match.

  • If no purchase price is specified, the current stock price will be used!

  • If the goods are not in stock, the purchase price from the price list will be used!

Another option is to let the REST API create the credit note including all links

In addition to the ID of the invoice being credited (tag <dobropisovanyDokl>), you also need to specify which line items you want to credit (tag <polozkyDokladu>). For each line item, you must provide its <id> according to the standard rules and the quantity to be credited (tag <mnozMj>).

This results in a fully featured credit note with line item-level links.

<winstrom version="1.0">
<faktura-vydana>
<typDokl>code:DOBROPIS</typDokl>
<!-- Lze uvést další vlastnosti dokladu, jako při běžném importu. -->
<dobropisuj>
<dobropisovanyDokl>code:VF1-0001/2021</dobropisovanyDokl>
<polozkyDokladu>
<polozka>
<id>123</id>
<mnozMj>1</mnozMj>
</polozka>
</polozkyDokladu>
</dobropisuj>
</faktura-vydana>
</winstrom>

If a line item has tracked serial numbers, you must enter the corresponding number of serial numbers (tag <vyrobniCislaId>).

<winstrom version="1.0">
<faktura-vydana>
<typDokl>code:DOBROPIS</typDokl>
<!-- Lze uvést další vlastnosti dokladu, jako při běžném importu. -->
<dobropisuj>
<dobropisovanyDokl>code:VF1-0001/2021</dobropisovanyDokl>
<polozkyDokladu>
<polozka>
<id>123</id>
<mnozMj>1</mnozMj>
<vyrobniCislaId>
<vyrobniCisloId>456</vyrobniCisloId>
</vyrobniCislaId>
</polozka>
</polozkyDokladu>
</dobropisuj>
</faktura-vydana>
</winstrom>

It is also possible to enter serial numbers for kits (tag <vyrobniCislaSad>).

<winstrom version="1.0">
<faktura-vydana>
<typDokl>code:DOBROPIS</typDokl>
<!-- Lze uvést další vlastnosti dokladu, jako při běžném importu. -->
<dobropisuj>
<dobropisovanyDokl>code:VF1-0001/2021</dobropisovanyDokl>
<polozkyDokladu>
<polozka>
<id>123</id>
<mnozMj>1</mnozMj>
<vyrobniCislaSad>
<vyrobniCislaSady>
<sadaId>789</sadaId>
<vyrobniCislaId>
<vyrobniCisloId>456</vyrobniCisloId>
</vyrobniCislaId>
</vyrobniCislaSady>
</vyrobniCislaSad>
</polozka>
</polozkyDokladu>
</dobropisuj>
</faktura-vydana>
</winstrom>

Automatically create a mutual offset at the same time

If the element <vytvorZapocet>true</vytvorZapocet> is included, a mutual offset will be automatically created, which will settle both the invoice and the credit note.

To create a mutual offset, you must specify the document type for offsets in the element <typDoklZapocet>.

The date of the more recent document will be used as the offset date. The variable symbol from the invoice will be used as the summary number.

When matching documents in a foreign currency, the exchange rate downloaded for the offset date will be used.

<winstrom version="1.0">
<faktura-vydana>
<!-- dobropis; může být i "faktura-prijata" -->
<id>code:DOBROPIS1</id>
<!-- Lze uvést další vlastnosti dokladu, jako při běžném importu. -->
<vytvor-vazbu-dobropis>
<dobropisovanyDokl>code:FAKTURA1</dobropisovanyDokl>
<!-- identifikátor dobropisovaného dokladu-->
<vytvorZapocet>true</vytvorZapocet>
<!-- pokud je uvedeno a je true, vytvoří se zároveň i vzájemný zápočet-->
<typDoklZapocet>code:ZAPOCET</typDoklZapocet>
<!-- povinný, pokud je uvedeno <vytvorZapocet>true</vytvorZapocet> -->
</vytvor-vazbu-dobropis>
</faktura-vydana>
</winstrom>

Important notes

  • The service creates only the link — the credit note document must have its line items correctly set up.

  • The created link adds only a header-level connection between documents; it does not handle line item linking.

  • The purchase price specified on the line items should correspond to the stock price of the goods from the credited document; otherwise, the stock balance will not match.

  • If no purchase price is specified, the current stock price will be used!

  • If the goods are not in stock, the purchase price from the price list will be used!

Removing a credit note link

<?xml version="1.0"?>
<winstrom version="1.0">
<faktura-vydana>
<!-- dobropis; může být i "faktura-prijata" -->
<id>code:DOBROPIS1</id>
<zrus-vazbu-dobropis/>
</faktura-vydana>
</winstrom>
Did this answer your question?