Skip to main content

Creating an Invoice from Paid Deposits

How can I create an invoice directly from paid deposits in the REST API?

Written by Petr Pech

Using the REST API, you can create an invoice from advance payments settled via bank, cash register, or mutual offset.

This is the equivalent of the "Create invoice from advance payment" service for issued or received invoices. The difference is that from the desktop application, you run the service on the given invoice — here, in the API function, you instead need the payment identifier.

This approach can be considered faster than the function for deducting advance payments or tax documents for advance payments. Here you don't need the advance payment identifier, but rather the payment identifier.


How the function works

The basic structure of the request body looks the same as for any other invoice. It contains both required and optional properties, such as typDokl, cisDosle, or datSplat. You can find all available properties in the so-called evidence list.

The <vytvorZUhrazenychZaloh> element must contain uhrazujiciDokl to identify the document with which the advance payment was settled:

<vytvorZUhrazenychZaloh>
<uhrazujiciDokl>code:B+0005/2022</uhrazujiciDokl>
</vytvorZUhrazenychZaloh>

You also need the uhrazujiciEvidence element to identify the record type to which this document belongs. You can choose from banka, pokladni-pohyb, and vzajemny-zapocet:

<vytvorZUhrazenychZaloh>
<uhrazujiciDokl>code:B+0005/2022</uhrazujiciDokl>
<uhrazujiciEvidence>banka</uhrazujiciEvidence>
</vytvorZUhrazenychZaloh>

🚨 In this element, the cash register record is named pokladni-pohyb, not pokladna. This element is required, and if the value is incorrect or missing, the call will fail with error 400, code akceEvidenceList: "This action is available for the following record types: banka, pokladni-pohyb, vzajemny-zapocet."


Service limitations

  • This service can only be used for the same transaction types. Otherwise, the call will fail with error 400: "The advance payment transaction type (Expense) must match the transaction type of the new document (Receipt)."

  • This service can only be used for newly created documents. Otherwise, the call will fail with error 400: "The action 'vytvorZUhrazenychZaloh' is not allowed on existing documents."

  • The API currently does not support advance payments with serial numbers.


Complete examples

Creating an issued invoice from advance payments settled via bank:

<winstrom version="1.0">
<faktura-vydana>
<typDokl>code:FAKTURA</typDokl>
<cisDosle>123</cisDosle>
<datSplat>2022-01-17</datSplat>
<vytvorZUhrazenychZaloh>
<uhrazujiciDokl>code:B+0005/2022</uhrazujiciDokl>
<uhrazujiciEvidence>banka</uhrazujiciEvidence>
</vytvorZUhrazenychZaloh>
</faktura-vydana>
</winstrom>

Creating a received invoice from advance payments settled via cash register:

<winstrom version="1.0">
<faktura-prijata>
<typDokl>code:FAKTURA</typDokl>
<cisDosle>123</cisDosle>
<datSplat>2022-01-17</datSplat>
<vytvorZUhrazenychZaloh>
<uhrazujiciDokl>code:P-0001/2022</uhrazujiciDokl>
<uhrazujiciEvidence>pokladni-pohyb</uhrazujiciEvidence>
</vytvorZUhrazenychZaloh>
</faktura-prijata>
</winstrom>


Related

Did this answer your question?