# BR-DE-20 SEPA direct debit account must be a valid IBAN

When an invoice specifies SEPA direct debit payment instructions (payment means code BT-81 = 59), XRechnung rule BR-DE-20 requires the debited account identifier (BT-91) to be a syntactically valid International Bank Account Number (IBAN) conforming to ISO 13616. The identifier must consist of a two-letter country code, two check digits, and up to 30 alphanumeric characters, satisfying the MOD-97 check algorithm. Clearing houses and banking engines reject direct debit collection mandates if the debited IBAN contains spaces, dashes, or invalid checksums.

## Problem Description

> **WARNING**: German XRechnung rule (KoSIT, BR-DE) · XRechnung 3.0

## Context and Significance

Rule BR-DE-20 is a warning-level check in XRechnung 3.0. However, invalid IBAN values cause direct debit batch files (pain.008) generated from the invoice to be rejected by commercial banks.

## Solution

In your customer bank master records, sanitize the debtor IBAN by removing spaces, hyphens, and text labels (such as "IBAN:"). In UBL 2.1 syntax, populate the clean IBAN in <cac:PaymentMeans><cac:PaymentMandate><cac:PayerFinancialAccount><cbc:ID>DE89370400440532013000</cbc:ID></cac:PayerFinancialAccount></cac:PaymentMandate></cac:PaymentMeans>. In UN/CEFACT CII syntax, populate <ram:PayerPartyDebtorFinancialAccount><ram:IBANID>DE89370400440532013000</ram:IBANID></ram:PayerPartyDebtorFinancialAccount> under <ram:SpecifiedTradeSettlementPaymentMeans>.

- [Validate XML](/en/xrechnung-validator?source=resource&rule=BR-DE-20)
- [Convert invoice](/en/pdf-to-xrechnung?source=resource&rule=BR-DE-20)

## Valid Examples

- BT-91 = "DE89370400440532013000" (Valid German IBAN with correct check digits)
- BT-91 = "AT611904300234573201" (Valid Austrian IBAN)

## Invalid Examples

- BT-91 = "0532013000" (Legacy national bank account number instead of international ISO 13616 IBAN)
- BT-91 = "DE89 3704 0044 0532 0130 00" (IBAN string formatted with spaces)

## Code Examples

### Valid XML
```
<cac:PaymentMeans>
  <cbc:PaymentMeansCode>59</cbc:PaymentMeansCode>
  <cac:PaymentMandate>
    <cac:PayerFinancialAccount>
      <cbc:ID>DE89370400440532013000</cbc:ID>
    </cac:PayerFinancialAccount>
  </cac:PaymentMandate>
</cac:PaymentMeans>
```

### Invalid XML
```
<cac:PaymentMeans>
  <cbc:PaymentMeansCode>59</cbc:PaymentMeansCode>
  <cac:PaymentMandate>
    <cac:PayerFinancialAccount>
      <cbc:ID>0532013000</cbc:ID>
    </cac:PayerFinancialAccount>
  </cac:PaymentMandate>
</cac:PaymentMeans>
```

## Affected Fields

- [BT-91 Debited account identifier](/resources/xrechnung/bt-91-debited-account-identifier)
- [BG-19 Direct debit](/resources/xrechnung/bt-89-mandate-reference-identifier)
- [BT-81 Payment means type code](/resources/xrechnung/bt-81-payment-means-type-code)

## Related Rules

- [BR-DE-31](/resources/kosit-validator-errors/br-de-31-direct-debit-requires-debited-account)

## Validation Tools

- [Official KoSIT Validator](https://github.com/itplr-kosit/validator): Run the official KoSIT validator with the XRechnung configuration to check EN 16931 and XRechnung rules.
- [Convert PDF to XRechnung](/pdf-to-xrechnung): Find validation errors during conversion and review each correction.

## Related Resources

- [Official Specification](https://xeinkauf.de/xrechnung/)
- [Test Suite](https://github.com/itplr-kosit/xrechnung-testsuite)
- [All validation errors](/resources/kosit-validator-errors): Overview of the EN 16931, XRechnung and Peppol validation rules explained here.
