Skip to main content

Set up an invoice template

Create and publish a template of type invoice in Debbie, then send its templateId together with lineItems. The template supports the same mentions as a letter, HTML themes and Word (.docx) templates.

Add the invoice data

The following example uses Add case vouchers:
Use the existing lineItems format: each item has id, name, quantity, price, taxRate, netAmount and taxAmount. Prices and amounts use minor currency units. For example, -100000 represents a DKK 1,000.00 charge. Amounts follow the voucher’s sign convention: charges are negative and discounts are positive. Unit prices and net amounts exclude VAT; taxRate: 25 means 25% VAT. quantity and taxAmount may be fractional. price and netAmount are integers. Supply the net and tax amounts from your bookkeeping system. Debbie uses these values without recalculating them from quantity, price or tax rate. It sums VAT before rounding it to a minor unit; half units round away from zero. Subtotal plus rounded VAT must equal the voucher amount. referenceId is the invoice number. A valid date, dueDate, and at least one line are required when generating a PDF. The template must be published and available to the tenant; creditor-specific templates must match the case’s creditor. Do not supply an uploaded appendix together with templateId. Generation completes before a successful response. The PDF is saved as the created voucher’s appendix (fileId, fileName, contentType). This endpoint returns case and voucher identifiers; retrieve the vouchers to access the PDF. No email or letter is sent automatically. A rendering or validation error fails the request. The invoice PDF is generated once when the voucher is created. Later changes to the due date, line items, other voucher fields or custom properties do not change or regenerate the saved PDF.

Invoice mentions

All letter mentions are available, including the existing currency mention {{currency}}. These additional fields refer to the invoice voucher: The HTML theme can loop over caseVoucher.lineItems. Each item has id, name, quantity, price, taxRate, netAmount, taxAmount and total; monetary fields, quantities and VAT percentages are formatted for display, with charges shown as positive amounts. In Word, use a row loop {#caseVoucher.lineItems} … {/caseVoucher.lineItems} with {name}, {quantity}, {price}, {taxRate}, {netAmount} and {taxAmount}. Ordinary Word fields use single braces, for example {caseVoucher.referenceId}. You can also insert the generated table with the HTML tag {~~caseVoucher.lineItemsTable}. The template editor preview always uses demo invoice lines, dates and invoice number, combined with the selected test case for ordinary letter mentions. Actual PDFs use the specific case voucher’s values.