Skip to main content
New German e-invoicing mandate from 2027: Kontier issues XRechnung and ZUGFeRD natively German e-invoicing 2027: XRechnung native

Validating XRechnung against EN 16931: schema, Schematron, rejects

7 min read Kontier editorial team

An XRechnung can leave your serializer without errors, look fine in a viewer, and still be rejected by a public authority's invoice inbox. Almost always there is a rule behind it that nobody ran beforehand. This article covers how validation is layered, how to put the KoSIT validator into your invoicing pipeline, which rule failures keep showing up on SaaS invoices, and what to do after a reject. Which fields a SaaS invoice has to carry in the first place is covered in implementing XRechnung for SaaS invoices.

For tax purposes, validation is not a condition for an invoice to be recognised. The German Federal Ministry of Finance still recommends it explicitly in its e-invoicing FAQ (German), and recommends doing it when the invoice is created and sent. For public-sector buyers the question hardly arises: their inbound platforms validate incoming XRechnung files automatically, and whatever fails comes back as a reject.

Three validation layers, three classes of error

When people say "validation" they often mean only one of three layers. The distinction matters because each layer finds different errors, and a different team has to fix them.

Layer What it checks Typical error Who fixes it
XML schema (UBL 2.1 or CII) Structure, data types, element order Date in the wrong format, element in the wrong place Engineering (serializer)
EN 16931 Schematron The standard's business rules: totals, VAT breakdown, mandatory fields VAT amount doesn't match the taxable amount Billing logic, data model
XRechnung Schematron National rules, recognisable by the BR-DE prefix Buyer reference BT-10 missing Master data, sales, finance

Schema validation turns green quickly and tells you little. The real errors sit in the two Schematron layers, because that is where the business logic lives. The EN 16931 rules come from CEN; the national additions are maintained by KoSIT as part of the XRechnung standard (German), which also states which version is currently in force.

A fourth check is not part of the standard but decides delivery: does the recipient know the Leitweg-ID you passed, and does it accept invoices over the channel you chose? No validator can know that. That check belongs in your customer master data.

Wiring the KoSIT validator into the invoicing pipeline

The KoSIT validator is a validation engine without rules of its own. A configuration made of scenarios defines what it checks, and KoSIT publishes one for XRechnung. The validator detects the format, checks against schema and Schematron, writes an XML report and derives an acceptance recommendation from it. It runs as a command-line tool, as a library, or in daemon mode as an HTTP service:

java -jar validator-<version>-standalone.jar -s scenarios.xml -r <repository> invoice.xml
java -jar validator-<version>-standalone.jar -s scenarios.xml -r <repository> -D   # daemon mode

For a billing platform, daemon mode is usually the practical choice. The invoicing service posts every generated XML to an internal endpoint and gets the report back. Three rules have proved useful.

First, pin the validator configuration version in your repository like any other dependency. An update is its own pull request with its own test run, not a silent download when the container starts.

Second, store the report with the invoice, together with invoice ID, configuration version and timestamp. If a buyer asks months later why an invoice looked the way it did, you answer from the archive.

Third, if the report recommends rejection, the invoice is not sent. It gets the status blocked and lands in a queue with rule ID and affected field. Warnings may pass but are counted. If their number rises after a release, a mapping has changed.

In CI, the same validator runs against a fixed set of test invoices: a standard invoice, a credit note, reverse charge, a tax-exempt supply, two VAT rates on one invoice, and an invoice with hundreds of thousands of usage units at tiny unit prices. If any of them breaks, the release stops.

Five rule failures that keep showing up on SaaS invoices

VAT rounded per line

EN 16931 has no VAT amount per invoice line. VAT is calculated per VAT category on the sum of net amounts: BT-116 times the rate gives BT-117. Many billing systems calculate and round per line instead. An example with three usage lines at €12.35 net each and 19% VAT:

  • rounded per line: 3 × €2.35 = €7.05 VAT
  • per category: €37.05 × 19% = €7.0395, rounded to €7.04 VAT

One cent apart. Don't count on the validator to flag it: rules that check calculated amounts can allow rounding tolerances. The cent then resurfaces as a mismatch between XML, PDF and ledger entry, or when the customer's inbound system recalculates. Fix rounding per VAT category and use the same function for PDF, XML and ledger.

Buyer reference missing

XRechnung requires the buyer reference (BT-10) on every invoice. For public-sector buyers, that is where the Leitweg-ID goes. If it is missing from the customer record, the invoice should never be serialized. A business-level pre-check catches this before the validator reports it.

Reverse charge without a reason

VAT category AE at 0% is not enough. For this category the rules require identifiers for both parties, in practice their VAT IDs, and an exemption reason as text or code (BT-120 or BT-121). Under German law the invoice must also carry the note "Steuerschuldnerschaft des Leistungsempfängers". The rest of what belongs on it is covered in creating a reverse charge invoice.

Totals that don't add up

The standard checks a chain: sum of line amounts, minus allowances, plus charges gives the net total; plus VAT gives the gross total; minus amounts already paid gives the amount due. A discount that exists only as a text line on the PDF, or a credit balance subtracted straight from the amount due, breaks the chain.

Service period missing or shifted

With subscriptions and usage, the invoice date is not the date of supply. State the billing period, at document level in BG-14 and for individual lines in BG-26. A classic: start and end dates are derived in different time zones, and the March period suddenly ends on 1 April. Derive both dates in the same time zone, the one in the contract.

What to do after a reject

A reject is first a diagnostic question: did the content of the invoice change, or only its technical representation?

  1. Technical error with correct content, such as a wrong code list value or a mis-mapped element: fix the mapping, regenerate the XML from the same finalised invoice data, validate again and send. Both attempts stay in the archive with timestamps.
  2. Missing master data such as a Leitweg-ID or purchase order number: block the invoice, get the data from the customer, store it versioned on the customer account, then regenerate.
  3. Wrong content such as amount, VAT rate or service period: the original invoice is not overwritten. Correct it with a cancellation or credit note referencing the original invoice (BT-25), then reissue.

Whether a case belongs in group 1 or group 3 is not always obvious. Agree the line once with your tax adviser and record it in your process documentation instead of renegotiating it with every reject.

For the status model this means rejected is a state of its own, not a return to draft. If rejected and accepted invoices share one sent status, your dunning run chases invoices that never reached the customer's accounts payable team. Payment terms in your system should start from the accepted version.

What to check before the next invoice run

  • Does the validator run automatically after every XML generation, and does an error block sending?
  • Is the XRechnung configuration version pinned and recorded in the validation report?
  • Is VAT rounded per category, with the same function for PDF, XML and ledger?
  • Does every public-sector customer have a Leitweg-ID on the account before the invoice is created?
  • Does CI include test invoices for credit notes, reverse charge, two VAT rates and tiny unit prices?
  • Are XML, validation report and PDF archived under the same invoice ID, for eight years in Germany?

Kontier generates XRechnung, PDF and ledger data from the same versioned pricing and tax data; the connected formats and payment methods are listed under integrations.

Not tax or legal advice. This post describes the law and common practice in general terms. For your own case, ask your tax adviser. As of:

Book a demo

A technical demo: 15 minutes with an engineer on your pricing model and tax setup.

How we handle your details: privacy policy.

Prefer email? contact@frontieralgorithmics.com

Message Kontier

Write to us right here. We reply by email, usually within one business day.

How we handle your details: privacy policy.

Personal invitation · 30 days

Try Kontier for 30 days, with a personal invite

We set up a trial account for you and send the invite personally. No credit card, the trial ends on its own.

Your invite arrives within 48 hours at the address you enter, sent by a person, not a script.

Separate from the public 14-day trial, which starts with a card on the pricing page.