Examples
This page shows complete examples for common situations, from a first service invoice to reading an e-invoice you received. Find the situation closest to yours, copy the code and adapt it. If you have not rendered an invoice yet, start with Getting started. Terms such as ZUGFeRD, XRechnung or profile are explained in E-invoicing basics.
Every example runs in Quittio's test suite against the current version. The XML the examples produce passed the official validator of KoSIT, the German agency that publishes XRechnung. It checks the rules of EN 16931, XRechnung and Peppol BIS Billing 3.0 (Rules and validation). Each example starts with the situation, then shows the code, then explains the important lines with links to the reference.
| Example | Situation and what it shows |
|---|---|
| Service invoice | Hours and hosting for a German business: service period, cash discount, ZUGFeRD |
| Different VAT rates and a discount | Goods at 7 % and 19 %: lines as arrays, a discount split per VAT rate |
| Online shop | A consumer who paid at checkout: prices including VAT, a voucher |
| Small business | A seller who charges no VAT (section 19 UStG, the German VAT Act) and has no VAT identification number |
| Public sector | A German public authority: XRechnung with Leitweg-ID (the buyer's routing ID), PDF copy |
| Advance payment and final invoice | A project paid in two parts: advance payment invoice, final invoice with deduction |
| Cancellation | An issued invoice that was wrong: full and partial cancellation with $result->cancel() |
| Self-billing | You write the invoice for your supplier: "Gutschrift" (self-billed invoice) |
| EU business: services | A service for a business in Belgium: reverse charge (the customer owes the VAT), Peppol BIS |
| EU business: goods | Goods for a business in Austria: intra-community supply, deliver-to address |
| Export | A customer outside the EU, invoiced in US dollars |
| Foreign currency with German VAT | A German customer invoiced in US dollars: VAT stated in euro |
| Invoices for orders | Orders in your Laravel application: Eloquent models, storing and mailing |
| Drafts and previews |