{number}
`, JSON of the data | | File name | `Invoice_{number}.{ext}` | | Documents | Calculated; fake HTML and, unless `htmlOnly()`, a fake PDF; file name `{number}.{ext}` | | Events | As in a real run: `InvoiceRendering`, `InvoiceValidated` (with the empty result, not in mode `off`) and `InvoiceRendered`, so `Event::fake()` with `Event::assertDispatched(InvoiceRendered::class)` works | | Queue | `queue()->save()` records the job (`queued()`, `assertQueued()`) and dispatches it like a real run: `Queue::fake()` sees it, a `sync` queue renders it with the fake | Not faked: `check()`, `prepare()`, `read()`, `readFile()`, `validateFile()`, `validatePath()` and `cancellation()` run the real core. Responses, `save()` and mail attachments work on the fake results. The fake stays active until the application is rebuilt for the next test. ### Assertions of the fake These methods belong to the fake and are also callable through the facade (`Quittio::assertRendered()`): | Method | Asserts / returns | |---|---| | `assertRendered(?callable $callback = null)` | At least one invoice was rendered; with a callback, at least one `RenderedInvoice` for which it returns `true` | | `assertRenderedCount(int $count)` | Exactly `$count` invoices were rendered | | `assertNothingRendered()` | No invoice was rendered | | `assertDocumentRendered(?callable $callback = null)` | At least one document (quote, reminder, …) was rendered; with a callback, one `RenderedDocument` matches | | `rendered(): array` | The recorded `RenderedInvoice` results (the main format of each call), in order | | `documents(): array` | The recorded `RenderedDocument` results, in order | | `assertQueued(?callable $callback = null)` | At least one invoice was queued with `queue()->save()`; with a callback, one `RenderInvoice` job matches (`$job->data()` is the invoice, `$job->disk`, `$job->path`) | | `assertNothingQueued()` | No invoice and no document was queued | | `assertDocumentQueued(?callable $callback = null)` | At least one document was queued with `Quittio::document(…)->queue()->save()`; with a callback, one `RenderDocument` job matches (`$job->data()` is the document) | | `queued(): array` | The recorded `RenderInvoice` jobs, in order | Documents such as quotes and reminders ([Quotes and other documents](documents.md)) are recorded separately from invoices: ```php $fake = Quittio::fake(); Quittio::document($quote)->htmlOnly()->render(); expect($fake->documents())->toHaveCount(1) ->and($fake->documents()[0]->hasPdf())->toBeFalse(); ``` ## Validating the invoice data A test with the fake does not show whether the invoice is a valid e-invoice. `check()` runs the real validation, including the XML, without rendering a PDF. It is never faked, so it also works while the fake is active: ```php laravel use Quittio\Laravel\Facades\Quittio; it('builds a valid e-invoice for an order', function () { $order = Order::factory()->create(); $report = Quittio::make($order)->check(); // the real validation, without rendering expect($report->isValid())->toBeTrue() ->and($report->warnings())->toBe([]); }); ``` ```php plain use Quittio\Core\Quittio; use Quittio\Country\DE\CountryDE; it('builds a valid e-invoice for an order', function () { $order = new Order(/* … */); $report = Quittio::create([], [new CountryDE])->make($order)->check(); // the real validation, without rendering expect($report->isValid())->toBeTrue() ->and($report->warnings())->toBe([]); }); ``` - `Order` is a model or class of your application that implements `ProvidesInvoiceData` ([Invoices for orders](examples.md#invoices-for-orders)). Any invoice data works the same way: `Quittio::make($invoice)->check()`. - `check()` returns a `ValidationResult` and never throws a `ValidationException` for invalid data. `isValid()` is `true` without errors; `warnings()` lists the warnings ([The result](validation.md#the-result)). - It validates in the same formats and profiles as `render()` would. The PDF/A check (level L6) does not run, because it needs the rendered PDF ([When validation runs](validation.md#when-validation-runs)). - To validate a rendered PDF or XML file, use [`assertValidEInvoice()`](#assertions). ## Laravel fakes Without `Quittio::fake()` the real core renders. Then the usual Laravel fakes test the integration end to end: files on a disk, events and queued jobs. `InvoiceData::factory()` builds the test invoice ([Factory](#factory)): ```php use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Queue; use Illuminate\Support\Facades\Storage; use Quittio\Core\Data\InvoiceData; use Quittio\Laravel\Events\InvoiceRendered; use Quittio\Laravel\Events\InvoiceValidationFailed; use Quittio\Laravel\Facades\Quittio; use Quittio\Laravel\Jobs\RenderInvoice; it('stores the PDF', function () { Storage::fake('invoices'); Quittio::make(InvoiceData::factory()->make())->format('zugferd')->render()->save('invoices', '2026/'); Storage::disk('invoices')->assertExists('2026/Rechnung_RE-2026-0042.pdf'); }); it('dispatches the events', function () { Event::fake([InvoiceRendered::class, InvoiceValidationFailed::class]); Quittio::make(InvoiceData::factory()->make())->format('cii')->render(); Event::assertDispatched(InvoiceRendered::class, fn ($e) => $e->result->format() === 'cii'); Event::assertNotDispatched(InvoiceValidationFailed::class); }); it('queues the rendering', function () { Queue::fake(); Quittio::make(InvoiceData::factory()->make())->queue()->save('invoices', 'queued/'); Queue::assertPushedOn('quittio', RenderInvoice::class, fn (RenderInvoice $job) => $job->path === 'queued/'); }); ``` - The factory's invoice is German (locale `de`), so the file name starts with the German title "Rechnung" (invoice). - The events are described in [Events](laravel.md#events), the queue in [Queueing](laravel.md#queueing). `quittio` is the default queue name. - Rendered results are `Attachable`. So `Mail::fake()` with `Mail::assertSent(YourMail::class, fn ($mail) => $mail->hasAttachment($result))` checks mail attachments. - After changing `config('quittio.…')` inside a test, the next call uses the new configuration ([Configuration](configuration.md)). ## Assertions The trait `Quittio\Laravel\Testing\InteractsWithQuittio` adds two assertions for rendered files to a test case. `assertValidEInvoice()` checks that a PDF or XML is a valid e-invoice. `assertXmlMatchesSnapshot()` checks that the XML has not changed since you last accepted it. Add the trait to your tests: ```php // PHPUnit use Quittio\Laravel\Testing\InteractsWithQuittio; class InvoiceTest extends TestCase { use InteractsWithQuittio; } // Pest, in a single test file uses(InteractsWithQuittio::class); // Pest, for all tests of a directory (in tests/Pest.php) pest()->use(InteractsWithQuittio::class)->in('Feature'); ``` After each test the trait also resets the process-wide state of Quittio (`Quittio\Core\Quittio::resetState()`), e.g. base rates that a test registered. Then use the assertions on the outputs of a rendered invoice: ```php $result = Quittio::make(InvoiceData::factory()->make())->formats(['zugferd', 'xrechnung-ubl'])->render(); $this->assertValidEInvoice($result->pdf(), 'en16931'); $this->assertValidEInvoice($result->as('xrechnung-ubl')->xml(), 'xrechnung'); $this->assertXmlMatchesSnapshot($result->xml(), 'zugferd-default'); ``` | Method | Asserts | |---|---| | `assertValidEInvoice(string $pdfOrXml, ?string $profile = null)` | Reads the PDF or XML content and validates it with all configured levels (`quittio.validation.levels`, see [below](#official-validators-in-ci)). Fails with the code and message of every error; warnings do not fail. With `$profile`, the profile read from the file must be that profile (aliases are resolved, e.g. `comfort`). | | `assertXmlMatchesSnapshot(string $xml, ?string $name = null)` | Compares the canonicalised XML (whitespace between elements removed, re-indented) with a stored snapshot. The first run writes the snapshot and passes. Not well-formed XML fails. | The profile is the set of rules the file follows, e.g. `en16931` or `xrechnung` ([Profiles](concepts.md#profiles)). ### Snapshots A snapshot is a stored copy of the XML. Later runs compare the XML with it, so that an unintended change of the output fails the test. - Snapshots are stored in `__snapshots__/quittio/{name}.xml` next to the test file. - The name is reduced to letters, digits, `.`, `_` and `-`. Without a name it is `{TestClass}__{test name}`. Pest generates class and test names, so pass a name there. - To accept a changed XML, delete the snapshot file and run the test again. - Override the protected methods `quittioSnapshotDirectory()` and `quittioSnapshotName()` to change the location and the default name. ### Outside test case classes Outside test case classes, e.g. in Pest helper functions, `Quittio\Laravel\Testing\EInvoiceAssertions` provides the same assertions: ```php use Quittio\Laravel\Testing\EInvoiceAssertions; (new EInvoiceAssertions)->assertValidEInvoice($pdf, 'xrechnung'); (new EInvoiceAssertions(base_path('tests/__snapshots__')))->assertXmlMatchesSnapshot($xml, 'order-42'); ``` Its constructor takes the snapshot directory (default `tests/__snapshots__/quittio` below the working directory). Its default snapshot name is `xml`, so pass a name per snapshot. ## Factory Most tests need an invoice. `InvoiceData::factory()` (or `Quittio\Core\Testing\InvoiceFactory::new()`) builds one in a single line. The test invoices are deterministic: they contain no random values, so XML snapshots stay stable. Every method returns a new factory. ```php use Quittio\Core\Data\InvoiceData; InvoiceData::factory()->make(); // one line, 19 % InvoiceData::factory()->reverseCharge()->withLines(5)->make(); InvoiceData::factory()->intraCommunity()->calculated(); InvoiceData::factory()->b2c()->currency('USD')->number('X-1')->make(); InvoiceData::factory()->creditNote()->state(fn ($builder) => $builder->buyerReference('04011000-12345-03'))->make(); ``` The base invoice is the one of the scenarios (`Scenarios::base()`): - number `RE-2026-0042`, issue date 2026-10-03, delivery date 2026-09-30, locale `de`; - seller Muster GmbH (`DE123456789`, Musterstadt), buyer Kunde AG (`DE987654321`), buyer reference `PO-4711`; - payment terms 14 days and a SEPA credit transfer. With the German country pack the automatic choice renders these invoices as ZUGFeRD, and with `b2c()` as plain PDF. `withLines(3)` gives net 140.00, VAT 26.60 and an amount due of 166.60. | Method | Effect | |---|---| | `withLines(int $count)` | Number of lines (at least 1). Line *i*: "Item *i*", quantity *i* pieces, net price 10 × *i*, VAT 19 % (or the category of the VAT mode) | | `reverseCharge()` | Buyer Client SARL (Paris, `FR12345678901`), lines in category `AE` (reverse charge) with `VATEX-EU-AE` | | `intraCommunity()` | Buyer Cliente S.r.l. (Rome, `IT12345678901`), lines in category `K` (intra-community supply) with `VATEX-EU-IC` | | `export()` | Buyer Customer Inc. (New York, no VAT identifier), lines in category `G` (export) with `VATEX-EU-G` | | `b2c()` | Consumer buyer Erika Mustermann (Berlin), no buyer reference | | `currency(string $currency)` | Invoice currency; other than EUR adds the VAT accounting currency EUR (rate 0.9 of 2026-10-02) and a credit transfer | | `number(string $number)` | Invoice number (default `RE-2026-0042`) | | `creditNote()` | Type code 381 with the preceding invoice RE-2026-0001 of 2026-09-01 | | `state(callable $state)` | Calls `$state(InvoiceBuilder $builder)` for free changes; several states run in order | | `builder(): InvoiceBuilder` | The prepared builder | | `make(): InvoiceData` | Invoice data, not calculated (as passed to `Quittio::make()`) | | `calculated(?TotalsCalculator $calculator = null): InvoiceData` | Invoice data with totals and VAT breakdown, calculated with `$calculator` (default `En16931Calculator`) | `VATEX-EU-…` are the codes of the VAT exemption reasons ([Exemption reasons in the VAT breakdown](building-invoices.md#exemption-reasons-in-the-vat-breakdown)). ## Scenarios `Quittio\Core\Testing\Scenarios` holds realistic sample invoices: the ones of the preview, the visual tests and the official validation runs. Use them when a test needs special content, e.g. 60 lines for page breaks or sub lines. They are country neutral: they use VAT categories directly, not the tax presets of a country pack. ```php laravel use Quittio\Core\Testing\Scenarios; use Quittio\Laravel\Facades\Quittio; $invoice = Scenarios::make('sub-lines')->number('T-1')->build(); $result = Quittio::make($invoice)->profile(Scenarios::profile('sub-lines'))->format('zugferd')->render(); ``` ```php plain use Quittio\Core\Testing\Scenarios; $invoice = Scenarios::make('sub-lines')->number('T-1')->build(); $result = $quittio->make($invoice)->profile(Scenarios::profile('sub-lines'))->format('zugferd')->render(); ``` Without Laravel, `$quittio` is the instance created in [Without Laravel](getting-started.md#without-laravel). `php artisan quittio:preview --scenario=simple` renders a scenario with your template ([quittio:preview](commands.md#quittiopreview)). | Method | Returns | |---|---| | `Scenarios::names(): array` | All scenario names | | `Scenarios::make(string $name): InvoiceBuilder` | The builder of a scenario; an unknown name throws an `InvalidArgumentException` | | `Scenarios::profile(string $name): string` | Best profile: `extended` for `sub-lines`, `peppol` for `peppol`, otherwise `en16931` | | `Scenarios::base(): InvoiceBuilder` | Seller, buyer, dates and payment of all scenarios, without lines | Each scenario also has a static method (`Scenarios::simple()`, `manyLines()`, `longTexts()`, `mixedVat()`, `reverseCharge()`, `intraEu()`, `export()`, `cancellation()`, `subLines()`, `foreignCurrency()`, `b2cGross()`, `allowances()`, `attachments()`, `peppol()`). | Name | Content | |---|---| | `simple` | Two lines (24 h web development, monthly hosting with a period), 19 %, 2 % cash discount within 7 days | | `many-lines` | 60 lines with item numbers, 7 % and 19 % (page breaks) | | `long-texts` | Long note and description, item attributes | | `mixed-vat` | 7 %, 19 % and zero rated lines, 10 % document discount | | `reverse-charge` | French buyer, reverse charge (`AE`) | | `intra-eu` | Italian buyer, intra-community supply (`K`), delivery address, country of origin, HS code | | `export` | US buyer, export (`G`) | | `cancellation` | Credit note ST-2026-0007 cancelling RE-2026-0042 | | `sub-lines` | Line with three sub lines, invoicee and delivery terms (profile EXTENDED) | | `foreign-currency` | USD invoice with the VAT accounting currency EUR | | `b2c-gross` | Consumer buyer, gross prices, 7 % and 19 % | | `allowances` | Line allowance and charge, document charge and allowance, price base quantity, list price with discount | | `attachments` | Embedded CSV time sheet and an external document reference | | `peppol` | Belgian buyer, Peppol endpoints (`0208`, `9930`), reverse charge | ## Official validators in CI By default, rendering and `assertValidEInvoice()` use Quittio's PHP rules and the XSD schemas (levels `php` and `xsd`). Two official validators check more ([Rules and validation](concepts.md#rules-and-validation)): - the KoSIT validator (level L5) with the official Schematron rules of EN 16931, XRechnung and Peppol; KoSIT is the German agency that publishes XRechnung; - veraPDF (level L6), which checks that a PDF is a valid PDF/A file. They need Java and veraPDF. Run them in a separate test group, so that your fast tests do not need them: ```php use Quittio\Core\Data\InvoiceData; use Quittio\Core\Validation\Drivers\KositArtifacts; use Quittio\Laravel\Facades\Quittio; function useOfficialValidators(): void { $root = storage_path('quittio/validators'); // php artisan quittio:schemas:download config()->set('quittio.validation.levels', ['php', 'xsd', 'kosit', 'verapdf']); config()->set('quittio.validation.drivers.kosit', [ 'mode' => 'cli', 'jar' => $root.'/validator.jar', 'scenarios' => $root.'/xrechnung/scenarios.xml', 'repository' => $root.'/xrechnung', 'configurations' => [['scenarios' => KositArtifacts::peppolScenarios(), 'repository' => $root]], 'timeout' => 120, ]); config()->set('quittio.validation.drivers.verapdf', ['mode' => 'docker', 'image' => 'verapdf/cli']); } it('produces valid ZUGFeRD and XRechnung', function () { useOfficialValidators(); $invoice = InvoiceData::factory()->state(fn ($b) => $b->buyerReference('04011000-12345-03'))->make(); $result = Quittio::make($invoice)->formats(['zugferd', 'xrechnung-cii'])->render(); $this->assertValidEInvoice($result->pdf(), 'en16931'); $this->assertValidEInvoice($result->as('xrechnung-cii')->xml(), 'xrechnung'); })->group('official'); ``` - `php artisan quittio:schemas:download` downloads the validator and prints the values for `jar`, `scenarios`, `repository` and `configurations`. - In mode `cli` every validation starts a JVM (Java virtual machine). For many documents, run the validator as a daemon instead: `mode` `daemon` with `QUITTIO_KOSIT_URL` ([KoSIT validator](validation.md#kosit-validator-l5)). - The download command also prints the start command of the daemon, with `-P 8081` for the default URL `http://127.0.0.1:8081`. The validator's own default port is 8080. - An unreachable validator fails the validation with `KOSIT-UNAVAILABLE`, unless `fail_on_unavailable` is `false`. A GitHub Actions job for this group: ```yaml official-validation: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: shivammathur/setup-php@v2 with: php: '8.4' extensions: dom, libxml, mbstring, xmlwriter, zlib, intl, gd, bcmath, zip - uses: actions/setup-java@v6 with: distribution: temurin java-version: '21' - uses: actions/cache@v6 with: path: storage/quittio/validators key: quittio-validators-${{ hashFiles('composer.lock') }} - run: composer install --no-interaction --no-progress - run: php artisan quittio:schemas:download # keeps existing files - run: docker pull verapdf/cli - run: vendor/bin/pest --group=official ``` Exclude the group from the fast test job with `--exclude-group=official`. To check a single file by hand: `php artisan quittio:validate invoice.pdf --profile=en16931 --kosit --verapdf` ([Artisan commands](commands.md#quittiovalidate)). ## Managed layer factories The [Managed layer](managed.md) is the optional package `quittio/managed`: it stores invoices in your database, numbers and archives them. It ships Eloquent factories for its models (namespace `Quittio\Managed\Database\Factories`). Tests need the published Managed migrations (`quittio:install --managed`, see [Installation](managed.md#installation)) and a refreshed database. ```php use Quittio\Core\Data\InvoiceData; use Quittio\Managed\Models\Invoice; use Quittio\Managed\Models\Issuer; $issuer = Issuer::factory()->default()->create(); $invoice = Invoice::factory()->for($issuer)->create()->issue('2026-10-05'); $other = Issuer::factory()->company('Andere AG', 'DE111111111')->create(['key' => 'tenant-b']); $draft = Invoice::factory()->for($issuer)->data(InvoiceData::factory()->reverseCharge()->make())->create(); ``` `Issuer::factory()` (`IssuerFactory`) creates issuer profiles, the companies that issue invoices: | State | Attributes | |---|---| | (definition) | Key `issuer-{10 random characters}`; seller Muster GmbH with a random German VAT identifier (`DE` + 9 digits), Hauptstraße 1, 12345 Musterstadt, contact Max Muster, e-mail and electronic address `rechnung@muster.de`; country `DE`, time zone `Europe/Berlin`, bank account `DE02120300000000202051` / `BYLADEM1001`, defaults `locale` `de` and `due_days` 14; not the default issuer. Every issuer is a company of its own and gets its own number space. | | `default()` | Key `default`, default issuer, seller VAT identifier `DE123456789` | | `company(string $name, string $vatId)` | Another company: own name and VAT identifier, Marktplatz 2, 54321 Anderstadt, electronic address `rechnung@{slug of the name}.de` | `Invoice::factory()` (`InvoiceFactory`) creates drafts: | State | Attributes | |---|---| | (definition) | Draft (`status` draft, `kind` invoice) with the data of `InvoiceData::factory()->withLines(2)->make()` (number empty, totals not yet calculated), for a new issuer (`Issuer::factory()`) | | `data(InvoiceData $data)` | The columns of your invoice data instead | Issuing takes the number from the issuer's sequence. The documents are rendered in a queued job after the transaction. In tests, use `Queue::fake()`, or set `quittio-managed.queue.render_sync` to render in the same request. See [Managed layer](managed.md) for the lifecycle and [Testing against MySQL and PostgreSQL](managed.md#testing-against-mysql-and-postgresql). # Country packs A country pack holds everything in Quittio that differs between countries: VAT rates and exemption texts, national invoice rules and profiles, the formats a country prescribes, legal notices, letter layouts, numbering and retention periods, and the law on late payment. The core of Quittio stays country-neutral. Quittio ships a pack for Germany, and `quittio/quittio` installs it. Packs for [Austria](country-at.md), [Belgium](country-be.md), [Switzerland](country-ch.md) and [France](country-fr.md) are published as separate packages; their legal wording is not reviewed by a tax adviser yet ([Other countries](#other-countries)). Read this page when you invoice from Germany and need more than a standard invoice: an exemption or reverse charge, a small business invoice, XRechnung for a public buyer, a reminder with default interest or a letter layout after DIN 5008 (the German standard for business letters). Read it also when you want to support another country. If terms such as EN 16931, XRechnung, profile or `BR-DE` codes are new to you, read [E-invoicing basics](concepts.md) first. The page has two parts: | Part | For | Start with | |---|---|---| | **Using the German pack** | Everyone who invoices as a seller in Germany (most readers) | [Germany (`quittio/country-de`)](#germany-quittiocountry-de) | | **Writing a country pack** | Developers who add another country or change how a pack behaves | [How a pack is selected](#how-a-pack-is-selected), [Writing your own country pack](#writing-your-own-country-pack), [The `CountryPack` contract](#the-countrypack-contract) | The legal wording, references, rules and defaults of the German pack were reviewed in October 2026 and confirmed by a tax adviser; they reflect the law of that time. Quittio is no tax advice, and the issuer of an invoice remains responsible for it (see the legal review and the disclaimer in the README). ## Germany (`quittio/country-de`) The German pack implements German VAT law (the VAT Act UStG and its implementing ordinance UStDV), XRechnung and German business letter conventions. Its class is `Quittio\Country\DE\CountryDE` (code `DE`, translation namespace `quittio-de`). - **Installation.** Laravel discovers the pack automatically, so there is nothing to register. Without Laravel, pass `new CountryDE` to `Quittio::create()` (see [Registering packs](#registering-packs)). The builder macro `de()` leads to the German special cases (`Quittio\Country\DE\Builder\GermanInvoice`), e.g. `->de()->smallAmount()`; it is available as soon as Composer loads the package. Each method returns the builder, so the chain continues there. The macros of version 0.2 directly on the builder (`->smallAmount()`, `->selfBilled()` …) were removed in 1.0. `stubs/InvoiceBuilder.stub.php` describes `de()` for IDEs and PHPStan. - **When it applies.** The pack leads every invoice whose seller is in Germany (seller country code `DE`). It then checks the German rules, chooses the format and provides the defaults: the German locale (unless the invoice or the configuration sets one), A4 paper and the DIN 5008 form B layout. For an invoice from another country to a business in Germany, only its format rules apply, so that German public buyers receive XRechnung. Details are in [How a pack is selected](#how-a-pack-is-selected). - **Legal references.** This page writes German legal references in English form: "section 14 (4) no. 1 UStG" stands for "§ 14 Abs. 4 Nr. 1 UStG". Other laws cited are the Civil Code (BGB), the Fiscal Code (AO) and the VAT application decree (UStAE). Values that the pack stores or prints in German keep their German form. German terms such as Gutschrift, Kleinunternehmer or Leitweg-ID are explained on first use and in the [glossary](concepts.md#german-terms). Common tasks: | You want to | Read | |---|---| | Set the VAT rate or an exemption on a line | [Tax presets](#tax-presets) | | Invoice as a small business without VAT (Kleinunternehmer) | [Small businesses](#small-businesses) | | Invoice a business in another EU country | [Reverse charge, intra-community supplies and VAT identifiers](#reverse-charge-intra-community-supplies-and-vat-identifiers) | | Know which format Quittio picks (ZUGFeRD, XRechnung, PDF) | [Format choice](#format-choice) | | Invoice a German public authority | [Format choice](#format-choice), [XRechnung profiles](#xrechnung-profiles), [XRechnung rules](#xrechnung-rules) | | Issue an invoice of up to 250 € with fewer details | [Small amount invoices](#small-amount-invoices) | | Deduct advance payments in a final invoice | [Final invoices](#final-invoices-deductadvance) | | Issue a self-billed invoice (Gutschrift) | [Self-billing](#self-billing-gutschrift) | | Cancel or correct an invoice | [Cancellations and corrections](#cancellations-and-corrections) | | Send a reminder with default interest | [Dunning law](#dunning-law), [Default interest](#default-interest) | | Choose the letter layout | [DIN 5008 letter layouts](#din-5008-letter-layouts) | | Look up a validation code such as `DE-USTG-03` or `BR-DE-15` | [UStG rules](#ustg-rules), [XRechnung rules](#xrechnung-rules) | Complete invoices for these cases are on [Examples](examples.md#invoices-in-germany). ### Tax presets A tax preset is a ready-made VAT treatment for an invoice line. It sets the VAT category (BT-151) and the rate, and for exempt supplies also the exemption reason code (BT-121) and text (BT-120). Use a preset instead of a bare category and rate: the line then carries the wording German law requires, and the German rules recognise the case. Lines without `vat:` take the [default VAT](building-invoices.md#default-vat); in Laravel that is 19 % for a German seller and `VatPreset::SmallBusiness` for a small business. The categories are the codes of EN 16931: `S` standard rate, `Z` zero rated, `E` exempt, `AE` reverse charge, `K` intra-community supply, `G` export outside the EU, `O` not subject to VAT (see [Categories](building-invoices.md#categories)). `Quittio\Country\DE\Tax\VatPreset` is a string-backed enum that implements `TaxPreset`. Apply it per line: ```php laravel use Quittio\Core\Enums\UnitCode; use Quittio\Country\DE\Tax\VatPreset; use Quittio\Laravel\Facades\Quittio; $builder = Quittio::invoice() ->line('Web development', netPrice: '95.00', quantity: 24, unit: UnitCode::Hour, vat: VatPreset::Standard) // an exemption without its own case: legal reference and VATEX code; // the invoice prints "Steuerfrei nach § 4 Nr. 14 UStG" (exempt under section 4 no. 14 UStG) ->line('Medical treatment', netPrice: '90.00', unit: UnitCode::Piece, vat: VatPreset::exempt('§ 4 Nr. 14 UStG', 'VATEX-EU-132-1C')); ``` ```php plain use Quittio\Core\Enums\UnitCode; use Quittio\Country\DE\Tax\VatPreset; $builder = $quittio->invoice() ->line('Web development', netPrice: '95.00', quantity: 24, unit: UnitCode::Hour, vat: VatPreset::Standard) // an exemption without its own case: legal reference and VATEX code; // the invoice prints "Steuerfrei nach § 4 Nr. 14 UStG" (exempt under section 4 no. 14 UStG) ->line('Medical treatment', netPrice: '90.00', unit: UnitCode::Piece, vat: VatPreset::exempt('§ 4 Nr. 14 UStG', 'VATEX-EU-132-1C')); ``` In the plain PHP examples on this page, `$quittio` is the instance created in [Without Laravel](getting-started.md#without-laravel), with your company under `seller` in `Quittio::create()`: `$quittio->invoice()` adds it and its bank account, as `Quittio::invoice()` does from `config/quittio.php`. | Case | Key | Category | Rate | Code (BT-121) | Use | |---|---|---|---|---|---| | `Standard` | `de.standard` | `S` | 19 (of the supply date) | – | Standard rate | | `Reduced` | `de.reduced` | `S` | 7 (of the supply date) | – | Reduced rate | | `ZeroRatedPv` | `de.zero_rated_pv` | `Z` | 0 | – | 0 % rate for photovoltaic systems (section 12 (3) UStG). Category `Z` allows no exemption reason (BR-Z-10), so the preset adds the note "Steuersatz 0 % nach § 12 Abs. 3 UStG." (BT-22). Quittio does not check the conditions of the zero rate (operator, place of the system). | | `SmallBusiness` | `de.small_business` | `E` | 0 | – | Small business exemption (Kleinunternehmer, section 19 (1) UStG); see [Small businesses](#small-businesses) | | `ReverseChargeDomestic` | `de.reverse_charge_domestic` | `AE` | 0 | `VATEX-EU-AE` | Domestic reverse charge (section 13b UStG): the buyer in Germany owes the VAT | | `ReverseChargeEu` | `de.reverse_charge_eu` | `AE` | 0 | `VATEX-EU-AE` | Service to a business in another member state, which owes the VAT there. Both VAT identifiers are required (`DE-USTG-11`). Issue the invoice by the 15th of the following month (`DE-USTG-15`). | | `IntraCommunitySupply` | `de.intra_community_supply` | `K` | 0 | `VATEX-EU-IC` | VAT-exempt intra-community supply (section 4 no. 1b with section 6a UStG), also of new vehicles (`newVehicle()`). Not for small businesses, except new vehicles (`DE-USTG-14`). Issue the invoice by the 15th of the following month (`DE-USTG-15`). | | `TriangularTransaction` | `de.triangular_transaction` | `AE` | 0 | `VATEX-EU-AE` | Intra-community triangular transaction (section 25b UStG), in which the last customer owes the VAT; wording of section 14a (7) UStG, also as note (BT-22). Both VAT identifiers are required. | | `Export` | `de.export` | `G` | 0 | `VATEX-EU-G` | VAT-exempt export supply (section 4 no. 1a with section 6 UStG) | | `NotTaxableInGermany` | `de.not_taxable` | `O` | none | `VATEX-EU-O` | Supply not taxable in Germany (place of supply abroad). EN 16931 allows no VAT identifiers with category `O` (BR-O-02); the pack leaves them out when the seller's tax number is given ([Category O](#vat-identifiers-on-invoices-of-category-o)). | | `BusinessTransfer` | `de.business_transfer` | `O` | none | `VATEX-EU-O` | Transfer of a business as a whole (Geschäftsveräußerung im Ganzen, section 1 (1a) UStG), not subject to VAT. VAT identifiers as with `NotTaxableInGermany`. VAT shown on such an invoice would be owed under section 14c (1) UStG; category `O` cannot carry any. | | `MarginSecondHand` | `de.margin_second_hand` | `E` | 0 | `VATEX-EU-F` | Margin scheme, second-hand goods; wording of section 14a (6) UStG, also as note (BT-22) | | `MarginArt` | `de.margin_art` | `E` | 0 | `VATEX-EU-I` | Margin scheme, works of art; also as note (BT-22) | | `MarginAntiques` | `de.margin_antiques` | `E` | 0 | `VATEX-EU-J` | Margin scheme, collectors' items and antiques; also as note (BT-22) | | `TravelAgency` | `de.travel_agency` | `E` | 0 | `VATEX-EU-D` | Special scheme for travel agents; also as note (BT-22) | | `VatPreset::exempt(string $paragraph, $code = null)` | `de.exempt` | `E` | 0 | `$code` (enum, raw code or string) | Any other exemption, e.g. `§ 4 Nr. 14 UStG` | The codes in column BT-121 are VATEX codes: the standard codes for the reason of an exemption. `Standard` and `Reduced` take the rate that applied on the supply date of the line (`TaxTables::STANDARD_RATE`, `TaxTables::REDUCED_RATE`). The supply date is the end of the line period (BT-135), its start, the VAT point date (BT-7), the delivery date (BT-72), the end of the invoicing period (BT-74) or the issue date, in this order (`Quittio\Core\Tax\SupplyDate`). A delivery in August 2020 gets 16 % and 5 %, a correction of it issued in 2021 as well: ```php use Quittio\Core\Builder\InvoiceBuilder; use Quittio\Country\DE\Tax\VatPreset; InvoiceBuilder::make() ->issueDate('2021-01-20') ->deliveryDate('2020-08-15') ->line('Desk', netPrice: '400.00', vat: VatPreset::Standard); // 16 % ``` `VatPreset::Standard->rate()` returns the rate of today. The plausibility rule `DE-VAT-RATE` warns when a line of category `S` within the German VAT territory has a rate that applied neither as standard nor as reduced rate on its supply date. It cannot tell whether the right one of the two was chosen: 19 % on restaurant meals, which are reduced again since 1 January 2026 (section 12 (2) no. 15 UStG, not for drinks), passes unnoticed. Average rates of agriculture and forestry (section 24 UStG) are a legitimate exception; switch the rule off for them with `validation.rules.disabled` ([Switching rules off](validation.md#switching-rules-off-and-changing-their-severity)). Up to version 0.2 the presets were called `Standard19` (`de.standard_19`) and `Reduced7` (`de.reduced_7`). The cases were removed in 1.0, their keys stay readable: `taxPresets()->get('de.standard_19')`, `quittio.defaults.vat` and `VatPreset::fromKey('de.standard_19')` find `Standard`, and lines of stored invoices keep their key (`VatPreset::LEGACY_STANDARD_KEY`, `LEGACY_REDUCED_KEY`). `Standard`, `Reduced` and `ZeroRatedPv` carry no text, because EN 16931 forbids an exemption reason for these categories (BR-S-10, BR-Z-10). The other presets print an exemption reason (BT-120) in German or English, from `resources/lang/{de,en}/tax.php`: | Key | German | English | |---|---|---| | `de.small_business` | Steuerfreie Leistung nach § 19 Abs. 1 UStG (Steuerbefreiung für Kleinunternehmer). | VAT-exempt supply under section 19 (1) UStG (small business exemption). | | `de.reverse_charge_domestic` | Steuerschuldnerschaft des Leistungsempfängers (§ 13b UStG) | Reverse charge, the recipient is liable for VAT (section 13b UStG) | | `de.reverse_charge_eu` | Steuerschuldnerschaft des Leistungsempfängers | Reverse charge, the recipient is liable for VAT | | `de.intra_community_supply` | Steuerfreie innergemeinschaftliche Lieferung (§ 4 Nr. 1b i. V. m. § 6a UStG) | VAT-exempt intra-Community supply (section 4 no. 1b in conjunction with section 6a UStG) | | `de.triangular_transaction` | Innergemeinschaftliches Dreiecksgeschäft nach § 25b UStG; Steuerschuldnerschaft des letzten Abnehmers | Intra-Community triangular transaction (section 25b UStG); the last customer is liable for the VAT | | `de.export` | Steuerfreie Ausfuhrlieferung (§ 4 Nr. 1a i. V. m. § 6 UStG) | VAT-exempt export supply (section 4 no. 1a in conjunction with section 6 UStG) | | `de.not_taxable` | Nicht im Inland steuerbare Leistung (Leistungsort im Ausland) | Service not taxable in Germany (place of supply abroad) | | `de.business_transfer` | Nicht steuerbare Geschäftsveräußerung im Ganzen (§ 1 Abs. 1a UStG). | Transfer of a business as a whole, not subject to VAT (section 1 (1a) UStG). | | `de.margin_second_hand` | Gebrauchtgegenstände/Sonderregelung | Second-hand goods/special arrangements | | `de.margin_art` | Kunstgegenstände/Sonderregelung | Works of art/special arrangements | | `de.margin_antiques` | Sammlungsstücke und Antiquitäten/Sonderregelung | Collectors’ items and antiques/special arrangements | | `de.travel_agency` | Sonderregelung für Reisebüros | Special arrangements for travel agents | | `de.exempt` | Steuerfrei nach :paragraph | Exempt from VAT according to :paragraph | The English texts follow the terms of Directive 2006/112/EC ("exempt", "intra-Community supply", "Reverse charge"). The [legal texts](#legal-texts) of the same notices use the same wording. How presets behave: - **Language.** The text is taken in the invoice locale (`->locale()` on the builder) when the line is built. The enum presets and `VatPreset::exempt()` (a `Quittio\Country\DE\Tax\CustomVatPreset`) use German when the invoice has no locale. Other locales without a text fall back to English. - **Preset key.** The key stays on the line (`$line->vat->presetKey`). `DE-USTG-09`, `DE-USTG-11`, `DE-USTG-14`, `DE-USTG-15` and the small business detection rely on it. - **VAT breakdown.** Category, rate, code and text flow into the VAT breakdown (BG-23). When lines of one category and rate have different texts, the texts are joined in BT-120. The code (BT-121) is kept only when all codes agree; otherwise Quittio warns with `QUITTIO-EXEMPTION-CONFLICT`. - **Invoice notes.** The mapping table of KoSIT and FeRD (recommended by the BMF letter of 15 October 2026) puts the statements of section 14a (6) and (7) UStG into the invoice note (BG-1). The margin scheme, travel agency and triangular presets therefore add their text once as note (BT-22, subject `REG`) as well, and `ZeroRatedPv` its reference to section 12 (3) UStG. A note with the same text is not added twice. Presets of other packs can do the same by implementing `Quittio\Core\Tax\StatesInvoiceNote`. - **PDF.** The PDF lists the BT-120 texts of all categories other than the standard rate in its legal notes (`legalNotes`), together with the regulatory notes and without duplicates. Margin scheme and travel agency rows show no VAT amount and their lines no rate (section 14a (6) UStG), recognised by the code of the line. - **Margin scheme next to an exemption.** EN 16931 allows one VAT group of category `E` only (BR-E-01). A margin scheme line and a line exempt under section 4 UStG therefore share it in the XML, with both texts in BT-120 and no code in BT-121 (`QUITTIO-EXEMPTION-CONFLICT`). The PDF shows the two parts in rows of their own, "Sonderregelung, kein gesonderter Steuerausweis: 500,00 €" and "Umsatzsteuerfrei (Steuerbefreit) auf 90,00 €", which add up to the group in the XML. With a document level allowance or charge of category `E` the parts cannot be told apart; then one row reads "Steuerfrei bzw. Sonderregelung, kein gesonderter Steuerausweis: 590,00 €" (label `vat_row_exempt_special_scheme`). Either way no "0 %" appears next to the margin scheme. - **Allowances and charges.** Document level allowances and charges take a category and a rate, not a preset: `->charge(VatCategory::StandardRate, '19', amount: '10.00', reason: 'Shipping')`. - **Lookup by key**, e.g. from a database column: `VatPreset::fromKey('de.standard')` (null for keys of other packs; it also knows the keys of 0.2, which `VatPreset::from()` does not), `(new CountryDE)->taxPresets()->get('de.standard')` or, across all installed packs, `$quittio->countries()->taxPreset('de.standard')`. `de.exempt` is not part of the collection. ### Small businesses A small business (Kleinunternehmer, section 19 UStG) charges no VAT. Its invoices state the exemption instead. Three steps make an invoice a correct small business invoice: 1. **Mark the seller as a small business.** Set `quittio.seller.small_business = true` (applied by `Quittio::invoice()`), without Laravel `'small_business' => true` in `Quittio::create()` (applied by `$quittio->invoice()`), the Managed issuer setting `tax_settings.small_business`, or `->flag(Meta::FLAG_SMALL_BUSINESS)`. `Flags::SMALL_BUSINESS` is the same flag (`small_business`). With the flag, a standard rated line, allowance or charge is an error (`DE-USTG-09`). The flag does not set presets or texts. 2. **Use `VatPreset::SmallBusiness` on every line.** Lines without `->vat()` get it automatically when the invoice has the small business flag and the default VAT comes from the country pack (`CountryDefaultVat`; in Laravel always, see [Default VAT](building-invoices.md#default-vat)). The preset's text (BT-120) appears in the PDF. 3. **Give a seller identifier if you have no VAT identifier.** Without a VAT identifier, EN 16931 needs a seller identifier (BT-29) or a legal registration (BT-30) (rule BR-CO-26). In Laravel set `quittio.seller.identifiers` or `legal_registration` (see [Configuration](configuration.md)), without Laravel `->identifier()` or `->legalRegistration()` on the seller's `Party::make()` in `Quittio::create()`. ```php laravel use Quittio\Core\Enums\UnitCode; use Quittio\Laravel\Facades\Quittio; $builder = Quittio::invoice() // quittio.seller.small_business = true ->line('Consulting', netPrice: '80.00', unit: UnitCode::Hour); // VatPreset::SmallBusiness by default ``` ```php plain use Quittio\Core\Enums\UnitCode; $builder = $quittio->invoice() // 'small_business' => true in Quittio::create() ->line('Consulting', netPrice: '80.00', unit: UnitCode::Hour); // VatPreset::SmallBusiness by default ``` What the pack checks: - An invoice with the small business flag, or with a line that uses the preset, is a small business invoice under section 34a UStDV. It needs no service date (`DE-USTG-03`), and the PDF is not checked for one. The tax number or VAT identifier is still required (`DE-USTG-02`). - A small business needs no VAT identifier of its own for reverse charge services in another member state (`DE-USTG-11`; section 19 (1) sentence 2 UStG). The buyer's VAT identifier is still required. - A small business that takes part in the cross-border small business scheme may state its small business identification number (Kleinunternehmer-Identifikationsnummer, suffix `EX`) instead of the tax number (section 34a sentence 1 no. 2 UStDV). It is no VAT identifier and belongs to the tax number (BT-32): `->de()->smallBusinessId('DE123456789EX')` sets it there and sets the small business flag. `DE-TAX-NUMBER` accepts it. In a VAT identifier field (BT-31) it gets the info `QUITTIO-SME-ID` instead of a format warning. - A small business cannot use the exemption for intra-community supplies (category `K`; `DE-USTG-14`, section 19 (1) sentence 2 UStG). The only exception is the intra-community supply of a new vehicle (`->de()->newVehicle()`, section 19 (6) sentence 1 UStG). A complete invoice is in [Examples: Small business](examples.md#small-business). ### Reverse charge, intra-community supplies and VAT identifiers With reverse charge (German: Steuerschuldnerschaft des Leistungsempfängers), the buyer owes the VAT instead of the seller. The invoice shows no VAT and must say why. An intra-community supply (innergemeinschaftliche Lieferung) is a VAT-exempt delivery of goods to a business in another EU member state. Use the presets `ReverseChargeDomestic`, `ReverseChargeEu`, `TriangularTransaction` and `IntraCommunitySupply` for these cases ([Tax presets](#tax-presets)). The pack then checks: - **Wording.** Reverse charge rows (category `AE`) must name "Steuerschuldnerschaft des Leistungsempfängers" (`DE-USTG-06`, error; the buyer owes the VAT all the same). The texts of the reverse charge presets are accepted in every locale the pack ships, so English invoices with the presets pass as well. Your own texts must contain "Steuerschuldnerschaft". - **VAT identifiers.** Reverse charge in another member state and triangular transactions need the VAT identifiers of seller and buyer (`DE-USTG-11`). The rule does not apply to `ReverseChargeDomestic` (section 13b UStG), and a small business needs none of its own (section 19 (1) sentence 2 UStG). - **Deadline.** Invoices for intra-community supplies and for services in another member state (`ReverseChargeEu`) must be issued by the 15th of the month following the supply (`DE-USTG-15`, warning; section 14a (1) sentence 2 and (3) sentence 1 UStG). This includes final invoices: advance payments trigger no VAT on intra-community supplies, so the invoice for the supply is the one with the deadline. - **PDF.** The PDF must show the reverse charge or exemption note and the VAT identifiers (see [Mandatory PDF output](#mandatory-pdf-output)). - **Tax representative.** A tax representative of the seller (BG-11, `->taxRepresentative($name, $vatId, $address)`) satisfies `DE-USTG-02` and `BR-DE-16`. Its VAT identifier satisfies `DE-USTG-11` and the mandatory output. - **Number formats.** The tax number (Steuernummer, BT-32) of a seller in Germany is checked for format and check digit (`DE-TAX-NUMBER`, see [Tax number](#tax-number)). VAT identifiers are checked by the core plausibility rules: `QUITTIO-VATID-FORMAT` (for `DE` nine digits) and optionally `QUITTIO-VIES`, an online check against the EU's VIES service. The same rules warn about category `K` with a domestic or non-EU destination, and about `G` within the EU (see [Validation](validation.md#plausibility-l7)). Complete invoices are in [Examples: EU business: services](examples.md#eu-business-services), [EU business: goods](examples.md#eu-business-goods) and [Export](examples.md#export). ### Format choice Without `->format()`, Quittio chooses the format for each invoice ([Automatic choice](formats.md#automatic-choice)). The German pack adds only the cases in which German law prescribes a format. `Quittio\Country\DE\Formats\GermanFormatRule` returns a choice for these cases and null (no opinion) otherwise: | Condition | Format | Profile | |---|---|---| | The buyer reference (BT-10) is a Leitweg-ID with valid check digits, or the buyer's electronic address (BT-49) uses scheme `0204` (`GermanFormatRule::LEITWEG_SCHEME`) | `xrechnung-cii` | `xrechnung` | | A small amount invoice whose simplifications apply (`UstgRules::isSmallAmountInvoice()`), with seller and buyer in the German Inland (domestic territory under section 1 (2) UStG, i.e. without Büsingen and Heligoland; an address without country code counts as domestic) | `pdf` | – | | otherwise | – (null) | – | A Leitweg-ID is the routing ID of a German public buyer, such as an authority or a municipality. The buyer names it in the order, and it goes into the buyer reference (BT-10). Its last two digits are check digits. ```php laravel use Quittio\Core\Builder\Party; use Quittio\Laravel\Facades\Quittio; $builder = Quittio::invoice() ->buyerReference('04011000-12345-03') // a Leitweg-ID: XRechnung ->buyer(Party::make('Stadt Beispielstadt') ->electronicAddress('04011000-12345-03', '0204')); // or the same ID as electronic address (scheme 0204) ``` ```php plain use Quittio\Core\Builder\Party; $builder = $quittio->invoice() ->buyerReference('04011000-12345-03') // a Leitweg-ID: XRechnung ->buyer(Party::make('Stadt Beispielstadt') ->electronicAddress('04011000-12345-03', '0204')); // or the same ID as electronic address (scheme 0204) ``` - Order numbers shaped like a Leitweg-ID (e.g. `4711-01`) do not switch to XRechnung. A Leitweg-ID with a typo does not either; validation reports it as `DE-LEITWEG-ID-SUSPECT` (info, see [Leitweg-ID](#leitweg-id)). Correct it, set the `0204` endpoint as well, or choose the format explicitly (`->format('xrechnung-ubl')`). - An explicit `->format()` or a configured `quittio.defaults.format` always wins. Everything else follows the [general order of the resolver](formats.md#automatic-choice): - **Domestic business invoices:** the Peppol lookup of the resolver, if one is configured, then `zugferd` with the configured profile (`en16931` by default; EXTENDED when EXTENDED features are used). - **Consumers:** `pdf`. - **Cross-border invoices:** the e-invoicing obligation of section 14 (2) UStG covers only supplies between businesses established in Germany. Sellers outside the EU invoicing a German business get `pdf` from the resolver, sellers in other member states `zugferd`. Buyers in Büsingen or Heligoland are outside the EU VAT territory and get `pdf`. - **German public buyers** receive XRechnung whatever the seller's country: for cross-border invoices to a buyer in Germany, the rule runs as the rule of the buyer's pack. A complete invoice to a public buyer is in [Examples: Public sector](examples.md#public-sector). #### E-invoice obligation When an explicit format or profile produces no e-invoice, the German rules check whether one was required (section 14 (1) and (2), section 27 (38) UStG). A run produces an e-invoice when one of its formats writes XML of an EN 16931 profile; MINIMUM, BASIC WL and a plain `pdf` do not. `xrechnung-cii` with `pdf` in one run is an e-invoice with a readable copy. Drafts and previews (watermark) are not checked. The obligation applies when seller and buyer are in the German Inland and the buyer is a business. It does not apply to: - consumers (`->consumer()`); - supplies exempt only under section 4 no. 8 to 29 UStG, told by the legal reference ("§ 4 Nr. 14 UStG") or a VATEX code of Article 132 or 135; - small amount invoices up to 250 EUR gross (section 33 sentence 4 UStDV), with or without `->de()->smallAmount()`; - small businesses (section 34a sentence 4 UStDV); - tickets (section 34 UStDV, `->de()->ticket()`, flag `de.ticket`); - cancellations and corrections of earlier invoices (section 14.11 (1) sentence 9 UStAE). The supply date decides (`UstgRules::supplyDate()`, otherwise the issue date); for a prepayment invoice the issue date (BMF letter of 15 October 2026, marginal no. 2): | Supply | Other invoice (PDF, MINIMUM, BASIC WL) | |---|---| | before 2025 | no finding | | 2025 and 2026 | allowed if issued by 31 December 2026: warning `DE-EINVOICE-02` (a PDF needs the buyer's consent); issued later: error `DE-EINVOICE-01` | | 2027 | prior-year turnover above 800,000 EUR: error `DE-EINVOICE-01`. Otherwise allowed if issued by 31 December 2027: warning `DE-EINVOICE-02`; later: error | | from 2028 | error `DE-EINVOICE-01` | Set the turnover with `quittio.countries.de.prior_year_turnover_above_800k` (core: `Quittio::create(['countries' => ['de' => ['prior_year_turnover_above_800k' => true]]], …)`); the default is `false`. Both findings belong to the BMF error class "Formatfehler" (format error, marginal no. 6a). An other invoice instead of a required e-invoice is no administrative offence (marginal no. 28), but it is no proper invoice, and the buyer may lose the input tax deduction. #### Mapping table of KoSIT and FeRD Which mandatory detail of the UStG goes into which field of an e-invoice is set out in the mapping table of KoSIT and FeRD (Empfehlungen zu Pflichtangaben in einer E-Rechnung, as of 25 July 2025), which the BMF letter of 15 October 2026 recommends (marginal no. 8 f.). The pack follows it: exemption and reverse charge texts in BT-120 with the code in BT-121, the statements of section 14a (6) and (7) UStG also as note, the retention notice and "Gutschrift" as note, vehicle details as item attributes (BG-32), the date of receipt of an advance payment in BT-7, a service month as invoicing period (BG-14). Details such as time sheets may go into an embedded attachment, the type, quantity and kind of the service must be in the structured part (marginal no. 10 to 12). ### XRechnung profiles XRechnung is the German e-invoice standard for public buyers: EN 16931 with additional German rules, as an XML file in the CII or UBL syntax (see [Formats](concepts.md#formats)). The pack registers three profiles for it. XRechnung 3.0 is the one you normally use. The extension allows data that XRechnung 3.0 does not, such as sub lines. XRechnung CVD is XRechnung 3.0 for the procurement of road vehicles under the Clean Vehicles Directive (CVD, Directive (EU) 2019/1161). How Quittio writes XRechnung files is described in [Formats: XRechnung](formats.md#xrechnung). | | `XRechnung30` | `XRechnung30Extension` | `XRechnung30Cvd` | |---|---|---|---| | Key, name | `xrechnung`, XRechnung 3.0 | `xrechnung-extension`, XRechnung 3.0 Extension | `xrechnung-cvd`, XRechnung 3.0 CVD | | Specification identifier (BT-24), which names the profile in the XML | `urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0` | `urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0#conformant#urn:xeinkauf.de:kosit:extension:xrechnung_3.0` | `urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0#compliant#urn:xeinkauf.de:kosit:xrechnung:cvd_0.9` | | Level, syntaxes | EN 16931; CII and UBL | as XRechnung 3.0; sub lines only in UBL | as XRechnung 3.0 | | Default business process (BT-23) | `urn:fdc:peppol.eu:2017:poacc:billing:01:1.0` | same | same | | Additionally required | buyer reference (BT-10), seller electronic address (BT-34), buyer electronic address (BT-49), seller contact (BG-6), payment instructions (BG-16) | same | as XRechnung 3.0, plus contract reference (BT-12), tender or lot reference (BT-17) and at least one vehicle line (`BR-DE-CVD-…`) | | Embedded in a PDF | `xrechnung.xml`, XMP conformance level `XRECHNUNG`, `fx:Version` `3.0` | same | same | | Extras | VAT rate written in every breakdown, 0 for category `O` (BR-DE-14); cash discounts as `#SKONTO#` lines in the payment terms (BT-20); the [XRechnung rules](#xrechnung-rules) | sub lines, third party payments (BG-DEX-09, UBL invoices only), identifier schemes `XR01` to `XR03` in the ICD and EAS code lists | the item classification scheme `CVD` (BT-158-1) in the UNTDID 7143 code list; the [CVD rules](#xrechnung-cvd) | The profiles exist only when the pack is registered. Without it, the formats `xrechnung-cii` and `xrechnung-ubl` cannot be rendered, and incoming XRechnung files are reported as an unknown profile (`QUITTIO-READER-UNKNOWN-PROFILE`). ```php laravel use Quittio\Laravel\Facades\Quittio; Quittio::make($invoice)->format('xrechnung-ubl')->render(); // XRechnung 3.0, UBL Quittio::make($invoice)->format('xrechnung-ubl')->profile('xrechnung-extension')->render(); // extension Quittio::make($invoice)->format('xrechnung-cii')->profile('xrechnung-cvd')->render(); // Clean Vehicles Directive Quittio::make($invoice)->format('zugferd')->profile('xrechnung')->render(); // PDF/A-3 with xrechnung.xml ``` ```php plain $quittio->make($invoice)->format('xrechnung-ubl')->render(); // XRechnung 3.0, UBL $quittio->make($invoice)->format('xrechnung-ubl')->profile('xrechnung-extension')->render(); // extension $quittio->make($invoice)->format('xrechnung-cii')->profile('xrechnung-cvd')->render(); // Clean Vehicles Directive $quittio->make($invoice)->format('zugferd')->profile('xrechnung')->render(); // PDF/A-3 with xrechnung.xml ``` The automatic choice always uses `xrechnung`, also when the invoice carries extension data: the specification identifier never switches by itself. Choose `xrechnung-extension` explicitly for extension data. With `xrechnung`, third party payments fail with `QUITTIO-PROFILE-XRECHNUNG-EXTENSION-ONLY`. The same holds for `xrechnung-cvd`: request it when the buyer asks for an XRechnung CVD. #### XRechnung CVD A public buyer that procures road vehicles reports them under the Clean Vehicles Directive. The invoice then names the contract and the tender or lot, and every vehicle line carries the vehicle category as item classification with the scheme `CVD` (BT-158, `M1`, `M2`, `M3`, `N1`, `N2` or `N3`) and the vehicle type as item attribute `cva` (BT-160, BT-161: `clean`, `zero-emission` or `other`): ```php laravel use Quittio\Core\Enums\UnitCode; use Quittio\Country\DE\Tax\VatPreset; use Quittio\Laravel\Facades\Quittio; $invoice = Quittio::invoice() ->buyerReference('04011000-12345-03') ->contractReference('V-2026-0017') // BT-12 ->tenderReference('LOS-3') // BT-17 ->line(fn ($line) => $line->name('Elektro-Kleinbus')->quantity(1)->netPrice('68000.00')->vat(VatPreset::Standard) ->classification('M2', 'CVD') // vehicle category (BT-158) ->attribute('cva', 'zero-emission')) // vehicle type (BT-160, BT-161) ->line(fn ($line) => $line->name('Einweisung')->quantity(2, UnitCode::Hour)->netPrice('95.00')->vat(VatPreset::Standard)); // … seller, buyer, payment as for every XRechnung Quittio::make($invoice)->format('xrechnung-cii')->profile('xrechnung-cvd')->render(); ``` ```php plain use Quittio\Core\Enums\UnitCode; use Quittio\Country\DE\Tax\VatPreset; $invoice = $quittio->invoice() ->buyerReference('04011000-12345-03') ->contractReference('V-2026-0017') // BT-12 ->tenderReference('LOS-3') // BT-17 ->line(fn ($line) => $line->name('Elektro-Kleinbus')->quantity(1)->netPrice('68000.00')->vat(VatPreset::Standard) ->classification('M2', 'CVD') // vehicle category (BT-158) ->attribute('cva', 'zero-emission')) // vehicle type (BT-160, BT-161) ->line(fn ($line) => $line->name('Einweisung')->quantity(2, UnitCode::Hour)->netPrice('95.00')->vat(VatPreset::Standard)); // … seller, buyer, payment as for every XRechnung $quittio->make($invoice)->format('xrechnung-cii')->profile('xrechnung-cvd')->render(); ``` The constants of `XRechnung30Cvd` hold the values (`CLASSIFICATION_SCHEME`, `VEHICLE_CATEGORIES`, `ATTRIBUTE`, `ATTRIBUTE_VALUES`). Lines without a vehicle, such as services, need neither. Credit notes are possible in both syntaxes. ### XRechnung rules `Quittio\Country\DE\Rules\XRechnungRules` (level L3) are the business rules of the XRechnung profiles, with codes `BR-DE-…`. They apply whenever the profile is `xrechnung`, `xrechnung-extension` or `xrechnung-cvd`, whatever the seller's country; the rules `BR-DE-CVD-…` only with the specification identifier of XRechnung CVD. The severity follows the flags of the official Schematron, the rule file of the official validator. Rules flagged `fatal` ("muss", must) are errors, rules flagged `warning` ("soll", should) are warnings, and `BR-DE-TMP-32` (flagged `information`) is an info. The KoSIT validator (the official XRechnung validator) remains authoritative (see [Validation](validation.md)). | Rule | Severity | Reported when | |---|---|---| | `BR-DE-1` | error | no payment instructions (BG-16) | | `BR-DE-2` | error | no seller contact (BG-6) | | `BR-DE-3`, `BR-DE-4` | error | seller city (BT-37) or postcode (BT-38) missing | | `BR-DE-5`, `BR-DE-6`, `BR-DE-7` | error | seller contact without name (BT-41), phone (BT-42) or e-mail (BT-43) | | `BR-DE-8`, `BR-DE-9` | error | buyer city (BT-52) or postcode (BT-53) missing | | `BR-DE-10`, `BR-DE-11` | error | a deliver-to address (BG-15) without city (BT-77) or postcode (BT-78) | | `BR-DE-15` | error | no buyer reference (BT-10); for public buyers this is the Leitweg-ID | | `BR-DE-16` | error | a category other than `O` is used and the seller has no VAT identifier (BT-31), tax number (BT-32) or tax representative (BG-11) | | `BR-DE-17` | warning | type code (BT-3) not one of 326, 380, 384, 389, 381, 875, 876, 877 | | `BR-DE-18` | error | a line of the payment terms text (BT-20) starts with `#` but does not match `#SKONTO#TAGE=n#PROZENT=n.nn#` (optionally `BASISBETRAG=n.nn#`) | | `BR-DE-19` | warning | SEPA credit transfer (58) with an invalid IBAN (BT-84) | | `BR-DE-20` | warning | SEPA direct debit (59) with an invalid debited IBAN (BT-91) | | `BR-DE-22` | error | attachment file names (BT-125-2) not unique | | `BR-DE-23-a`, `BR-DE-23-b` | error | credit transfer (30, 58) without credit transfer data (BG-17), or with card (BG-18) or direct debit (BG-19) data | | `BR-DE-24-a`, `BR-DE-24-b` | error | card payment (48, 54, 55) without card data (BG-18), or with BG-17 or BG-19 data | | `BR-DE-25-a`, `BR-DE-25-b` | error | direct debit (59) without direct debit data (BG-19), or with BG-17 or BG-18 data | | `BR-DE-26` | warning | corrected invoice (384) without preceding invoice reference (BG-3) | | `BR-DE-27` | warning | seller phone (BT-42) with fewer than three digits | | `BR-DE-28` | warning | seller e-mail (BT-43) without exactly one `@` surrounded by at least two characters | | `BR-DE-30`, `BR-DE-31` | error | direct debit (BG-19) without creditor identifier (BT-90) or debited account (BT-91) | | `BR-DE-TMP-32` | info (flag `information` in the Schematron) | no delivery date (BT-72), invoicing period (BG-14) or period on every line (BG-26) | | `BR-DEX-01` | not checked | guaranteed by `MimeType`: its codes are exactly those the extension allows; `BR-CL-24` accepts `MimeType::Xml` (application/xml) only in the extension | | `BR-DEX-02` | warning | extension, UBL: the net amount of a line (BT-131) with sub lines is not the sum of the net amounts of its direct sub lines; replaces `QUITTIO-SUBLINES` | | `BR-DEX-03` | not checked | guaranteed by the data model: every sub line has exactly one `LineVat`, which the UBL writer writes as one VAT information (BG-DEX-06) | | `BR-DEX-04` | error | extension: scheme of a seller (BT-29-1), buyer (BT-46-1) or payee (BT-60-1) identifier neither in ISO/IEC 6523 nor `XR01` to `XR03`; `SEPA` is accepted for seller and payee, except in CII; replaces `BR-CL-10` | | `BR-DEX-05` | error | extension: scheme of a legal registration identifier (BT-30-1, BT-47-1, BT-61-1) neither in ISO/IEC 6523 nor `XR01` to `XR03`; replaces `BR-CL-11` | | `BR-DEX-06` | error | extension: scheme of an item standard identifier (BT-157-1) neither in ISO/IEC 6523 nor `XR01` to `XR03`; replaces `BR-CL-21` | | `BR-DEX-07` | error | extension: scheme of an electronic address (BT-34-1, BT-49-1) neither in the EAS code list nor `XR01` to `XR03`; replaces `BR-CL-25` | | `BR-DEX-08` | error | extension: scheme of the delivery location identifier (BT-71-1) neither in ISO/IEC 6523 nor `XR01` to `XR03`; replaces `BR-CL-26` | | `BR-DEX-09` | error | extension, UBL: amount due (BT-115) is not BT-112 − BT-113 + BT-114 + the third party payment amounts (BT-DEX-002); replaces `BR-CO-16` | | `BR-DEX-10` | error | extension, UBL: a third party payment (BG-DEX-09) without type (BT-DEX-001) | | `BR-DEX-11` | not checked | guaranteed by the data model: `ThirdPartyPayment` requires an amount (BT-DEX-002), and the reader skips payments without one | | `BR-DEX-12` | error | extension, UBL: a third party payment (BG-DEX-09) without description (BT-DEX-003) | | `BR-DEX-13` | error | extension, UBL: a third party payment amount (BT-DEX-002) with more than two decimals; amounts created with `Amount::of()` always have two, and a `Money` with more cannot be written | | `BR-DEX-14` | error | extension, UBL: a third party payment amount (BT-DEX-002) in another currency than the invoice currency (BT-5) | | `BR-DEX-15` | error | sub lines in XRechnung CII (sub lines need the extension in UBL) | | `DE-XRECHNUNG-EXT-01` | error | a credit note in profile `xrechnung-extension` with syntax UBL; the official validator configuration has no scenario for it. Cancel with the strategy `negative_invoice` (type code 380, negative amounts). | | `BR-DE-CVD-01`, `BR-DE-CVD-02` | error | XRechnung CVD without contract reference (BT-12) or tender or lot reference (BT-17) | | `BR-DE-CVD-03` | error | XRechnung CVD without a line that has an item classification (BT-158) with scheme `CVD` and an item attribute `cva` (BT-160) | | `BR-DE-CVD-04` | error | an item classification with scheme `CVD` that is not `M1`, `M2`, `M3`, `N1`, `N2` or `N3` | | `BR-DE-CVD-05` | error | an item attribute `cva` whose value (BT-161) is not `clean`, `zero-emission` or `other` | | `BR-DE-CVD-06-a`, `BR-DE-CVD-06-b` | error | a line with a `CVD` classification that has not exactly one `cva` attribute, or a line with a `cva` attribute that has not exactly one `CVD` classification | The `BR-DEX-…` rules apply only to the profile `xrechnung-extension`; those marked UBL are skipped when the XML is written in CII, where the official Schematron does not have them. As in the official validator configuration, where the replaced rules are only an information, the extension replaces `BR-CL-10`, `-11`, `-21`, `-25` and `-26` with `BR-DEX-04` to `BR-DEX-08` and, in UBL, `BR-CO-16` with `BR-DEX-09` and `QUITTIO-SUBLINES` with `BR-DEX-02` (`XRechnung30Extension::replacedRules()`), so a violation is reported once, with the official code. `#SKONTO#` lines state a cash discount (Skonto) in a form software can read: `TAGE` is the number of days, `PROZENT` the percentage and `BASISBETRAG` the base amount. Quittio writes structured cash discounts itself (`#SKONTO#TAGE=7#PROZENT=2.00#`), so `BR-DE-18` only concerns lines you put into the payment terms text yourself. ### Small amount invoices German law allows a simplified invoice for small amounts (section 33 UStDV). `->de()->smallAmount()` marks an invoice of at most 250.00 EUR gross as such a small amount invoice. The gross total counts, including exempt or non-taxable parts (section 14.6 (4) UStAE). The limit of the supply date applies (`TaxTables::SMALL_AMOUNT_LIMIT`: 150.00 EUR from 2007, 250.00 EUR from 2017; the raise applies to supplies from 1 January 2017), or of the issue date if the invoice states no supply date. As long as no reverse charge (`AE`) or intra-community supply (`K`) is involved, it relaxes: - `DE-USTG-01`: the buyer's address is not required (the seller's still is); - `DE-USTG-02`: no tax number or VAT identifier is required; - `DE-USTG-03`: no service date is required; - the mandatory PDF output for the tax number and the service date; - the format: `pdf` instead of `zugferd` when seller and buyer are in the German Inland. A Leitweg-ID still leads to XRechnung (see [Format choice](#format-choice)). `DE-USTG-08` enforces the limit. `DE-USTG-12` excludes reverse charge and intra-community supplies (section 33 sentence 3 UStDV): such invoices need all mandatory information and are not rendered as plain PDF. Possible distance sales (goods sent to a consumer in another member state, section 3c UStG) keep the simplifications, with a warning. ### Builder macros `Quittio\Country\DE\Builder\GermanInvoiceMacros` adds methods for German special cases to `InvoiceBuilder`, and so to `Quittio::invoice()`: | Macro | Use it for | Writes into the invoice | |---|---|---| | `smallAmount()` | an invoice of up to 250 € gross ([Small amount invoices](#small-amount-invoices)) | flag `de.small_amount` | | `propertyRelatedService(string $locale = 'de')` | a service in connection with a property for a non-business buyer, who must keep the invoice for two years | flag `de.property_related_service` and the note `LegalTexts::PROPERTY_RETENTION` (subject `REG`) | | `newVehicle(string $locale = 'de')` | the intra-community supply of a new vehicle | flag `de.new_vehicle` and the note `LegalTexts::NEW_VEHICLE` (subject `REG`). The vehicle details are your line attributes (`DE-USTG-07`). The vehicle lines use `VatPreset::IntraCommunitySupply` (`DE-USTG-13`), also for small businesses (`DE-USTG-14`). | | `selfBilled(string $locale = 'de')` | a self-billed invoice ([Self-billing](#self-billing-gutschrift)) | type code 389 and the note `LegalTexts::SELF_BILLING` (subject `REG`) | | `deductAdvance(InvoiceData $advance, string $locale = 'de', $received = null, string $style = 'prepaid')` | a final invoice that deducts an advance invoice ([Final invoices](#final-invoices-deductadvance)) | preceding invoice (BG-3), prepaid amount (BT-113) and the note `LegalTexts::ADVANCE_DEDUCTION` (subject `REG`); with `style: 'remainder'` negative lines and `LegalTexts::ADVANCE_DEDUCTION_REMAINDER` instead of BT-113 | | `advance($expectedService, $receivedOn = null, string $locale = 'de')` (only as `->de()->advance()`) | a prepayment invoice ([Prepayment invoices](#prepayment-invoices)) | type code 386, the note `LegalTexts::PREPAYMENT` or `PREPAYMENT_MONTH` (or `SERVICE_DATE_OPEN` without a date), with `$receivedOn` the VAT point date BT-7 and the note `PREPAYMENT_RECEIVED` | | `consumerDefaultNotice(string $locale = 'de')` | the notice that a consumer is in default 30 days after the due date (section 286 (3) BGB) | the note `LegalTexts::CONSUMER_DEFAULT` (subject `PMT`) | | `discountAgreement(string $agreement, string $locale = 'de')` (only as `->de()->discountAgreement()`) | an agreed bonus, rebate or other reduction whose amount is not known yet (section 14 (4) no. 7 UStG); naming the agreement is enough (section 14.5 (19) UStAE) | the note `LegalTexts::DISCOUNT_AGREEMENT` (subject `REG`) | | `smallBusinessId(string $id)` (only as `->de()->smallBusinessId()`) | a small business that states its small business identification number (suffix `EX`) instead of the tax number ([Small businesses](#small-businesses)) | the number as the seller's tax number (BT-32) and the flag `small_business` | | `serviceDateOpen(string $locale = 'de')` (only as `->de()->serviceDateOpen()`) | a prepayment invoice (386) whose date of the service is not agreed yet (section 14.8 (4) sentence 5 UStAE) | flag `de.service_date_open` and the note `LegalTexts::SERVICE_DATE_OPEN` (subject `REG`); no `DE-USTG-03` warning | The notes and their texts are listed in [Legal texts](#legal-texts). Macros are invisible to IDEs and static analysis. The pack ships a stub with their signatures, `stubs/InvoiceBuilder.stub.php`; it is never loaded at runtime. Add it to PHPStan (`vendor/quittio/quittio/packages/country-de/stubs/…` with the complete package): ```yaml parameters: stubFiles: - vendor/quittio/country-de/stubs/InvoiceBuilder.stub.php ``` - The `$locale` parameter selects the language of the note. It is independent of the invoice locale. - A locale with a region uses the text of its language (`en_GB` → English). Locales without a text of the pack get the German text (`LegalTexts::text()`). - Notes with subject `REG` (regulatory information) are listed in the PDF's legal notes (`legalNotes`). Notes with subject `PMT` (payment information) appear with the other notes. #### Prepayment invoices A prepayment invoice (Anzahlungsrechnung, type code 386) must show that it invoices an advance payment, e.g. by the expected date or month of the service (section 14.8 (1) and (4) UStAE). `->de()->advance()` sets the type code and the note: ```php laravel use Quittio\Core\Enums\UnitCode; use Quittio\Laravel\Facades\Quittio; $advance = Quittio::invoice() ->de()->advance('2027-03') // "Anzahlungsrechnung. Die Leistung wird voraussichtlich im März 2027 erbracht." ->line('Website relaunch, advance payment', netPrice: '1000.00', unit: UnitCode::LumpSum); $paid = Quittio::invoice() ->de()->advance('2027-03-15', receivedOn: '2026-10-01') // "… am 15.03.2027 erbracht. Die Anzahlung wurde am 01.10.2026 vereinnahmt." ->line('Website relaunch, advance payment', netPrice: '1000.00', unit: UnitCode::LumpSum) ->prepaid('1190.00'); ``` ```php plain use Quittio\Core\Enums\UnitCode; $advance = $quittio->invoice() ->de()->advance('2027-03') // "Anzahlungsrechnung. Die Leistung wird voraussichtlich im März 2027 erbracht." ->line('Website relaunch, advance payment', netPrice: '1000.00', unit: UnitCode::LumpSum); $paid = $quittio->invoice() ->de()->advance('2027-03-15', receivedOn: '2026-10-01') // "… am 15.03.2027 erbracht. Die Anzahlung wurde am 01.10.2026 vereinnahmt." ->line('Website relaunch, advance payment', netPrice: '1000.00', unit: UnitCode::LumpSum) ->prepaid('1190.00'); ``` - `$expectedService` is a date or a month (`"2027-03"`). `null` states that the date is not agreed yet (`serviceDateOpen()`, section 14.8 (4) sentence 5 UStAE). Either way `DE-USTG-03` does not warn. - `$receivedOn` is the date a payment was already received. It is stated as VAT point date (BT-7), to which the mapping table of KoSIT and FeRD assigns the date of receipt, and in a note (section 14 (4) sentence 1 no. 6 UStG). A prepayment invoice with a prepaid amount but no BT-7 gets `DE-USTG-17`. - XRechnung warns about type code 386 (`BR-DE-17`): its list names 326 and 380 but not 386. The mapping table of KoSIT and FeRD prescribes 386 for prepayment invoices all the same, so the warning is to be accepted. - **Cancellation.** A prepayment invoice is cancelled, fully or partly, with `Quittio::cancellation()` like any invoice, e.g. for an advance payment refunded because the supply is not made (section 17 (2) no. 2 UStG). The cancellation (381, or 380 with `negative_invoice`) carries the flag `prepayment_correction` (`Meta::FLAG_PREPAYMENT_CORRECTION`) and refers to the prepayment invoice (BG-3): `DE-USTG-03` asks it for no date of the supply. A corrected invoice of a prepayment invoice (`Quittio::correction()`) carries the flag as well and is checked like the prepayment invoice. A price reduction (`Quittio::priceReduction()`) of a prepayment invoice is refused: a lower price is settled in the final invoice. #### Final invoices (`deductAdvance`) A final invoice (Schlussrechnung, section 14 (5) sentence 2 UStG) states the full service with its full VAT and deducts the advance payments received. `->de()->deductAdvance(InvoiceData $advance, string $locale = 'de', $received = null, string $style = GermanInvoice::PREPAID)` does this for one advance invoice: ```php laravel use Quittio\Core\Enums\UnitCode; use Quittio\Country\DE\Builder\GermanInvoice; use Quittio\Country\DE\Tax\VatPreset; use Quittio\Laravel\Facades\Quittio; $advance = $advanceResult->data(); // the rendered advance invoice, already calculated $final = Quittio::invoice() // number, dates, buyer, payment … ->line('Website', netPrice: '3000.00', unit: UnitCode::Piece, vat: VatPreset::Standard) ->de()->deductAdvance($advance, received: GermanInvoice::RECEIVED_IN_FULL); ``` ```php plain use Quittio\Core\Enums\UnitCode; use Quittio\Country\DE\Builder\GermanInvoice; use Quittio\Country\DE\Tax\VatPreset; $advance = $advanceResult->data(); // the rendered advance invoice, already calculated $final = $quittio->invoice() // number, dates, buyer, payment … ->line('Website', netPrice: '3000.00', unit: UnitCode::Piece, vat: VatPreset::Standard) ->de()->deductAdvance($advance, received: GermanInvoice::RECEIVED_IN_FULL); ``` The advance invoice must be calculated. The data of a rendered invoice (`$result->data()`) already is; calculate data you built yourself with `(new En16931Calculator)->calculate($advanceInvoice)` (`Quittio\Core\Calculation\En16931Calculator`). With an advance invoice RE-2026-0040 of 1,000.00 EUR net plus 19 % VAT, the final invoice shows a gross total of 3,570.00 EUR, VAT 570.00 EUR, prepaid 1,190.00 EUR and an amount due of 2,380.00 EUR, with the note: > Abzüglich Anzahlung gemäß Rechnung RE-2026-0040 vom 01.09.2026: Entgelt 1.000,00 € zzgl. 19 % Umsatzsteuer 190,00 € (§ 14 Abs. 5 Satz 2 UStG). With `->de()->deductAdvance($advance, 'en')` the note is in English: "Less advance payment according to invoice RE-2026-0040 of 01/09/2026: net 1,000.00 € plus 19% VAT 190.00 € (section 14 (5) sentence 2 UStG)." - **Checks.** The advance invoice must be calculated (`totals` set), have a positive gross total and be in the currency of the final invoice. Otherwise an `InvalidArgumentException` is thrown. Set `->currency()` before calling the macro. - **Accepted documents.** Only documents that can be advance invoices are accepted (`GermanInvoice::ADVANCE_TYPES`): type codes 380 (commercial invoice), 386 (prepayment invoice), 326 (partial invoice), 875 (partial construction invoice) and 389 (self-billed invoice). Credit notes, debit notes, corrected invoices (384), final invoices (876, 877) and cancellations by negative invoice are rejected. - **Amount received.** Only advance payments actually received are deducted (section 14 (5) sentence 2 UStG). Pass what you received as `received:`: `GermanInvoice::RECEIVED_IN_FULL` (or the full amount) deducts the advance invoice's gross total plus its cash rounding (BT-114). A smaller amount, e.g. `received: '595.00'` for half of the example, deducts that amount: it is distributed over the VAT rows of the advance invoice in proportion to their gross amounts, and the VAT is taken out of each part at its rate (section 14.8 (5) UStAE). The note then names these amounts. Zero or more than the advance invoice throws an `InvalidArgumentException`. - **Unconfirmed amount.** Without `received:` the advance invoice is deducted in full as before, but the flag `de.advance_receipt_unconfirmed` is set and `DE-USTG-20` warns. Deducting an advance that was not paid states too little VAT; not deducting one that was paid makes you owe its VAT twice (section 14.8 (10) UStAE). - **Unpaid advance invoices.** Do not deduct them. The advance invoice need not be cancelled (section 14.8 (2) UStAE); you may cancel it for clarity in your accounts. - **Remainder invoice.** `style: GermanInvoice::REMAINDER` adds instead a line "Abzüglich Anzahlung gemäß Rechnung … vom …" per VAT row with quantity −1 and the net amount received, and the note `LegalTexts::ADVANCE_DEDUCTION_REMAINDER` ("Restrechnung: Abgezogen ist die vereinnahmte Anzahlung gemäß Rechnung …"). The invoice then shows only the VAT of the remainder (section 14.8 (11) UStAE), which the buyer's system cannot deduct twice. The default `PREPAID` (BT-113 with the itemisation in BT-22) is the variant the BMF letter of 15 October 2026 (marginal no. 3) explicitly accepts until 30 June 2030. - **Itemisation.** Every VAT row of the advance invoice is itemised. Standard rated rows read "Entgelt … zzgl. … Umsatzsteuer …" ("net … plus … VAT …", `LegalTexts::ADVANCE_DEDUCTION_TAXED`), other rows "Entgelt … ohne Umsatzsteuer" ("net … without VAT", `LegalTexts::ADVANCE_DEDUCTION_UNTAXED`). Rows are separated by semicolons. - **Language.** The whole note is in one language: the language of `$locale` if the pack has it (`de`, `en`), otherwise German. Amounts and dates are formatted in `$locale` when the note is in its language (e.g. `de_AT`). Otherwise they are formatted in the language of the note: `fr` gives the German note with German formatting. - **Several advance invoices.** Call the macro once per advance invoice; the prepaid amounts add up. - **Self-billed advances.** An advance settled by self-billing (389) must be deducted as well. If the final invoice is no self-billed invoice, `DE-USTG-19` notes the change of the way of invoicing. - **Review in 2030.** The acceptance of BT-113 with the itemisation in BT-22 ends on 30 June 2030 (BMF letter of 15 October 2026, marginal no. 3); the default will be reviewed then. A complete example with the advance invoice is in [Examples: Advance payment and final invoice](examples.md#advance-payment-and-final-invoice). ### Self-billing (Gutschrift) In self-billing, the buyer issues the invoice for the seller's supply. German law requires the word "Gutschrift" on such an invoice (section 14 (4) no. 10 UStG). Quittio uses "Gutschrift" only for self-billing; commercial credit notes and cancellations carry other titles. - `->de()->selfBilled()` sets type code 389 and adds the note "Gutschrift" (English variant: "Gutschrift (self-billed invoice)"). - The PDF is titled "Gutschrift" in German and "Self-billed invoice (Gutschrift)" in English, and shows the buyer as issuer. - `DE-USTG-04` requires the label on every self-billed type code (389, 261, 527); in an e-invoice the type code is label enough, so there it is a warning. - The mandatory output requires the title and the "Gutschrift" note in the PDF. What Quittio cannot check, and you must make sure of: - **Prior agreement.** Self-billing must be agreed before the first self-billed invoice (section 14 (2) sentence 2 UStG), best in writing, e.g. in the framework contract with the supplier. Without the agreement the document is no invoice, and the issuer loses the input tax deduction. The agreement is not stated on the document, so Quittio does not ask for it. - **Objection.** The supplier may object to a self-billed invoice (section 14 (2) sentence 6 UStG). It then loses its effect as invoice, for the future only (BFH XI R 41/20), and the supplier issues an invoice of its own. An objection is no cancellation; do not issue a cancellation for it. - **Corrections and cancellations** of a self-billed invoice come from its issuer, the buyer (section 14.11 (2) sentence 2 UStAE). `Quittio::cancellation()` keeps the document self-billed (261, or 389 negative for XRechnung). A complete example is in [Examples: Self-billing](examples.md#self-billing). ### Cancellations and corrections `CountryDE::correctionPolicy()` sets how invoices of a German seller are cancelled and corrected (see [Building invoices: cancellations and corrections](building-invoices.md#cancellations-and-corrections)): - **Cancellation strategy `credit_note`:** a cancellation is a credit note (type code 381) with positive amounts. - **Correction strategy `cancel_and_reissue`:** the Managed layer corrects an invoice by cancelling it and issuing a new one. Both cancellation strategies are permitted in Germany. Change them with `quittio.corrections.cancellation_strategy` and `quittio-managed.correction.strategy`. For the XRechnung extension in UBL use `negative_invoice` (`DE-XRECHNUNG-EXT-01`). A self-billed invoice (389) with a Leitweg-ID (BT-10), i.e. sent as XRechnung, is cancelled by a negative self-billed invoice (389) instead of a self-billed credit note (261): XRechnung lists 261 not among its type codes and warns (`BR-DE-17`). Receiving portals of public buyers may treat that warning strictly. An explicit `$strategy` or `corrections.cancellation_strategy` still wins. ZUGFeRD keeps 261. A corrected invoice (384) should state that it corrects and replaces the original (`DE-USTG-18`); `Quittio::correction()` adds the note. A price reduction (`Quittio::priceReduction()`) is titled "Entgeltminderung". What a correction does for the parties (for your users' information, not checked by Quittio): - **Seller.** VAT shown too high (section 14c (1) UStG) is corrected in the period of the correction (section 17 (1) sentence 7 UStG), whichever way you correct. - **Buyer.** A correction, also by cancellation and new invoice, takes effect back to the original invoice if it had the minimum details of seller, buyer, supply, consideration and VAT and the correction refers to it specifically (BFH V R 26/15, XI R 10/17; BMF letter of 18 September 2020). Quittio refers by number and date (BG-3) and the note. - **Procedure.** A correction is no retroactive event under section 175 (1) sentence 1 no. 2 and section 233a (2a) AO (section 14 (4) sentence 4 UStG). - **Double invoices.** If an invoice was issued twice, cancel the second one: its VAT is owed under section 14c (1) UStG until it is corrected. The policy also sets the document titles: | Kind | German | English | |---|---|---| | `cancellation` | Stornorechnung | Cancellation invoice | | `cancellation_self_billed` | Storno-Gutschrift | Cancellation of the self-billed invoice (Storno-Gutschrift) | | `correction` | Rechnungskorrektur | Corrected invoice | | `price_reduction` | Entgeltminderung | Price reduction | | `self_billed` | Gutschrift | Self-billed invoice (Gutschrift) | - `cancellation` and `cancellation_self_billed` title the documents of `Quittio::cancellation()`. - `correction` titles a corrected invoice (384) of `Quittio::correction()` and of the Managed layer. - `price_reduction` titles the documents of `Quittio::priceReduction()`. - `self_billed` titles self-billed invoices (389, 261, 527) unless the presentation sets a title. Locales without a title of their own fall back to English ("Self-billed invoice (Gutschrift)"), which keeps the word "Gutschrift" required by section 14 (4) no. 10 UStG. ### Dunning law When a customer pays late, German law (section 288 BGB) gives the seller default interest (Verzugszinsen) and, from business debtors, a flat rate of 40 EUR. The pack provides these values and a calculator for the interest. Quittio's documents do not apply them by themselves: calculate the interest with [`DefaultInterest`](#default-interest) and pass the results to a payment reminder (see [Documents: payment reminders](documents.md#payment-reminders)). `CountryDE::dunningLaw()` returns these values: | Value | Germany | |---|---| | Interest for business debtors | base rate plus 9 percentage points | | Interest for consumers | base rate plus 5 percentage points | | Flat rate for business debtors | 40.00 EUR | | Day count | actual/actual (`null`): 365 days, 366 in a leap year | | Consumer default | 30 days after due date and receipt of the invoice, if the invoice points this out (added to invoices for consumers automatically, see below) | | Reference rate | "Basiszinssatz (§ 247 BGB)", the base rate of section 247 BGB | #### Default interest `Quittio\Country\DE\Dunning\DefaultInterest` calculates the default interest on an open amount: | Method | Result | |---|---| | `__construct(?BaseRateTable $rates = null, ?DunningLaw $law = null)` | Without a table, `BaseRates::table()` is used (shipped and registered rates). Without a law, `CountryDE::dunningLaw()` (points, flat rate and day count). | | `calculate(Money $amount, Date $from, Date $until, bool $consumer = false, string $locale = 'de'): list