einvoice / EN 16931 / XRechnung rule reference

BR-DEX-14

What this rule means and how to fix it

The currency of 'Third party payment amount' (BT-DEX-002) must equal BT-5 (Invoice currency code): cbc:PaidAmount/@currencyID = parent::node()/cbc:DocumentCurrencyCode. A missing @currencyID or a missing DocumentCurrencyCode makes the node-set comparison false -> fires.

Die Währungsangabe von "Third party payment amount" BT-DEX-002 muss BT-5 ("Invoice currency code") entsprechen.

Deutsche Fassung: Amtlicher KoSIT-Text (official KoSIT assert text).

Requires
the currency of 'Third party payment amount' (BT-DEX-002) must equal BT-5 (Invoice currency code): cbc:PaidAmount/@currencyID = parent::node()/cbc:DocumentCurrencyCode. A missing @currencyID or a missing DocumentCurrencyCode makes the node-set comparison false -> fires.
Business terms
BT-5 BT-DEX-002
Syntax
Binds the UBL-2.1 Invoice / CreditNote syntax
Location (UBL-2.1 path)
/ubl:Invoice/cac:PrepaidPayment
Fix
Correct the calculated amount at `/ubl:Invoice/cac:PrepaidPayment` so that the currency of 'Third party payment amount' (BT-DEX-002) must equal BT-5 (Invoice currency code): cbc:PaidAmount/@currencyID = parent::node()/cbc:DocumentCurrencyCode. A missing @currencyID or a missing DocumentCurrencyCode makes the node-set comparison false -> fires.
Fix (Deutsch)
Korrigieren Sie den berechneten Betrag bei `/ubl:Invoice/cac:PrepaidPayment`, sodass gilt: Die Währungsangabe von "Third party payment amount" BT-DEX-002 muss BT-5 ("Invoice currency code") entsprechen.
Severity
fatal
Provenance source
xrechnung-ubl
Provenance assert

Die Währungsangabe von "Third party payment amount" BT-DEX-002 muss BT-5 ("Invoice currency code") entsprechen.

The Location above is a UBL-2.1 path, and no UN/CEFACT-CII path for this rule is published here; Fix and Fix (Deutsch), verbatim from remediation_catalog.json and not reworded here; the UBL-2.1 binding of this rule is differentially proven against the official KoSIT XRechnung 2.5.0 (XRechnung 3.0.2) Schematron.

Where to check the fix: paste the corrected invoice into the browser validator at /einvoice/validate/ — it runs this same engine locally in your browser, with no upload, and stops reporting BR-DEX-14 once the edit lands.

Korrektur prüfen: Laden Sie die geänderte Rechnung in den Browser-Validator unter /einvoice/validate/ — er führt dieselbe Engine lokal im Browser aus, ohne Upload, und meldet BR-DEX-14 nicht mehr, sobald die Korrektur greift.

The same invoice, failing and fixed

No vendored test suite ships a labelled example for this rule, so this pair was found rather than written. The engine was run over the vendored instance corpus/xrechnung-testsuite/src/test/business-cases/extension/05.01a-INVOICE_ubl.xml under --profile xrechnung, then re-run over the same file with one mechanical edit applied to one element, over and over, until the edit below changed the verdict: the text content of DocumentCurrencyCode was deleted, leaving the element present but empty. The page publishes it because the engine reported BR-DEX-14 for the edited document and did not report it for the untouched one.

UBL Invoice (XRechnung extension) — fails

The vendored file around the change, verbatim:

<cbc:DocumentCurrencyCode></cbc:DocumentCurrencyCode>

UBL Invoice (XRechnung extension) — passes

The same lines as 05.01a-INVOICE_ubl.xml actually ships them — this block is the fix for the block above:

<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>

What the engine reports for the edited invoice

{
  "element": "cac:PrepaidPayment/cbc:PaidAmount/@currencyID",
  "field": "cac:PrepaidPayment/cbc:PaidAmount/@currencyID",
  "fix_hint": "Correct the calculated amount at `/ubl:Invoice/cac:PrepaidPayment` so that the currency of 'Third party payment amount' (BT-DEX-002) must equal BT-5 (Invoice currency code): cbc:PaidAmount/@currencyID = parent::node()/cbc:DocumentCurrencyCode. A missing @currencyID or a missing DocumentCurrencyCode makes the node-set comparison false -> fires.",
  "location": "/ubl:Invoice/cac:PrepaidPayment",
  "message": "The currency of 'Third party payment amount' (BT-DEX-002) must equal the 'Invoice currency code' (BT-5).",
  "rule": "BR-DEX-14",
  "severity": "fatal",
  "terms": [
    "BT-5",
    "BT-DEX-002"
  ],
  "title": "The currency of 'Third party payment amount' (BT-DEX-002) must equal BT-5 (Invoice currency code): cbc:PaidAmount/@currencyID = parent::node()/cbc:DocumentCurrencyCode. A missing @currencyID or a missing DocumentCurrencyCode makes the node-set comparison false -> fires."
}

Rule ids the engine reports for 05.01a-INVOICE_ubl.xml untouched: BR-CO-16 BR-DE-TMP-32. After the edit, BR-05 BR-CL-04 BR-DEX-14 are reported that were not before — one mechanical edit can break more than one rule at a time, and BR-05 BR-CL-04 are the neighbours this one takes with it.

Two honest limits. This is an edit that provokes the rule, not the only one, and it is not a claim about how real exporters break it. And it is the reverse of the fix a reader needs: the passing block is the vendored file's own content, which is what a conformant invoice looks like here.

Reproduce it yourself: take corpus/xrechnung-testsuite/src/test/business-cases/extension/05.01a-INVOICE_ubl.xml from this repository, apply the one edit named above, and run einvoice validate 05.01a-INVOICE_ubl.xml --profile xrechnung --format json, or paste the file into the browser validator, which runs this same engine locally with no upload.

Everything here is free and open source — pick up whatever helps, at your own pace: