In short and in plain language
A shop can take money from a customer's bank account by direct debit. The customer gives permission for this when buying. This permission is called a mandate.
The mandate has its own number. This number belongs in the business system. From there the merchant collects the money through the bank.
For some time the customer can get the money back. The customer does not need to give a reason. Then the bank books the money back.
The bank reports this with a short code. The program finds the right order. In the shop the customer can then no longer pay by direct debit.
There is a special kind of direct debit for companies. There the money often cannot be taken back. We help you set it up.
The order came in through the shop on Monday, paid by direct debit. The customer gave the mandate at checkout, the ERP collected the amount with the next batch, and the goods shipped on Wednesday. Three weeks later the bank statement shows a returned debit with a code such as MD06, and on the same day the same customer orders again, once more by direct debit. The shop knows nothing about the return because it only reached accounting. This is where a direct debit that works parts ways with one that costs money: mandate data, collection and returns sit in three systems, and none of them sees the whole path. This article describes the data flow from the interface point of view: which mandate fields belong in the ERP, how the collection file is created, what the bank's return reasons mean, and how a returned debit is reported back automatically to the order, the delivery and the customer account in the shop.
Key takeaways
- With a SEPA Core direct debit, the payer can reclaim the amount within eight weeks of the debit without giving reasons (§ 675x(2) and (4) BGB). A payment received by direct debit is therefore only final once this period has passed.
- Mandate reference, creditor identifier, date of signature, sequence type and date of the last collection belong in the ERP customer master as separate fields. In the collection file, the mandate reference holds at most 35 characters (EPC).
- Under the scheme rules, the merchant has to send the pre-notification with amount and due date at least 14 calendar days before the due date, unless merchant and customer have agreed on a different period (EPC SDD Core Rulebook).
- Returned debits arrive with a reason code such as AM04 for insufficient funds or MD06 for a requested refund. The interface matches them to the order through the merchant reference, reopens the item and blocks direct debit in the customer account of the shop.
- A fee for choosing direct debit as the payment method is invalid (§ 270a BGB). Bank charges for a returned debit are booked separately per return; a flat fee in the terms and conditions has to stay within the limits of § 309 No. 5 BGB.
- Only non-consumers can be payers under the SEPA B2B direct debit (EPC). The refund claim is excluded only by an agreement between the payer and his bank once he has given his consent directly to the bank (§ 675x(3) BGB).
Three systems, one mandate: who keeps which data
With direct debit in online retail, three systems work together and each of them sees only part of the picture. The shop captures the account holder, the IBAN and the customer's consent. The ERP holds the receivable, creates the collection file and books the incoming payment. The bank collects the money and reports back through the bank statement what did not work. If you do not plan this path as one connected data flow, you get gaps exactly where they become expensive: at the returned debit.
Direct debit is no fringe case. In the second half of 2025, around 31 percent (ECB) of all non-cash payments in Germany, counted by number, were direct debits, more than in any other euro area country. For purchases on the internet, direct debit and credit transfer together accounted for 30 percent (Deutsche Bundesbank) of payments, behind online payment services, and with 45 percent (Deutsche Bundesbank) they had the largest share of online sales. The Bundesbank figures come from the payment diary of a representative sample of respondents and combine direct debit and credit transfer.
For the interface this means that, depending on the customer base, a considerable part of all orders depends on this data flow. The ground rule is to define one leading system per type of data and to let the other systems read only. The following split works in many architectures with an ERP and inventory integration:
| Data | Leading system | Who reads it |
|---|---|---|
| Account holder, IBAN, consent at checkout | Shop at capture, then ERP | Middleware validates and transfers |
| Mandate reference, creditor identifier, date of signature | ERP, customer master | Shop shows the reference in confirmation and account |
| Receivable, due date, pre-notification | ERP | Shop shows the due date in the customer account |
| Collection file, batch | ERP or payment module of accounting | Bank |
| Returned debit with reason code | Bank statement | ERP books it, shop applies the block |
| Direct debit block per customer | ERP | Shop hides the payment method |
The last row is the decisive one. Whether a customer may keep ordering by direct debit is decided in the ERP, because only there do receivable and return come together. The shop applies the decision by hiding the payment method at checkout. For business customers with open items, the credit limit check in the B2B checkout adds creditworthiness to this logic.
Capturing the mandate at checkout
Every collection is based on the mandate: the customer's consent that the merchant may debit the account, and at the same time the instruction to the customer's bank to honor the debit. The rulebook of the European Payments Council requires a mandate signed by the payer and expressly allows the creditor to offer an automated way of completing it, including an electronic signature (EPC SDD Core Rulebook). In online retail the mandate is therefore usually a form at checkout. Which form of consent your own bank accepts for this is governed by your agreement with it; settle that before launch, not afterwards.
Statistics from the European Central Bank show how common electronically given mandates are: in the second half of 2025, 13 percent (ECB) of direct debits in the euro area were based on an electronic mandate and 87 percent (ECB) on consent given in other forms. For the shop, the form matters less than the proof. Without a valid mandate the debit is unauthorized, and the payer can still dispute it with the bank for up to 13 months (§ 676b(2) BGB) after the day of the debit. The rulebook sets the same 13-month period for unauthorized direct debits (EPC SDD Core Rulebook).
The mandate data from checkout is therefore not a by-product of a form but evidence the merchant must be able to produce when asked. The rulebook requires the mandate to be stored for as long as it exists, and afterwards according to national requirements (EPC SDD Core Rulebook). The shop should record the following when the mandate is given and pass it on to the ERP:
- Name of the account holder as entered in the form, kept separate from the name of the buyer
- IBAN, validated in the shop for country code, length and check digits, and readable in the ERP only for authorized roles
- Time of consent and the wording of the mandate text in the version the customer saw
- Mandate reference and creditor identifier as stated in the mandate text
- Type of direct debit: one-off for this order or recurrent for further orders
- Order number and technical ID of the transaction, so the consent can be traced later
One trap lies in the IBAN check itself. Some shops accept only German IBANs at checkout. The SEPA Regulation prohibits this: a payee using a direct debit does not specify the member state in which the payer's payment account is to be located, provided the account is reachable (Art. 9(2) SEPA Regulation). The check therefore belongs on format and check digits, not on the country. How IBAN and account holder should be handled in the interface logs is covered in the article on customer data in integration logs.
Mandate reference and creditor identifier as keys in the customer master
Two identifiers carry the mandate through the entire payment path: the merchant's creditor identifier and the mandate reference. The Bundesbank sums up their role by saying that together they make a direct debit mandate uniquely identifiable (Deutsche Bundesbank). In Germany, the Bundesbank issues the creditor identifier on electronic application. It does not yet entitle the merchant to collect, though; for that, the merchant's own bank has to agree (Deutsche Bundesbank).
The merchant assigns the mandate reference. The rulebook does not limit its length, but the implementation guidelines for the collection file allow at most 35 characters (EPC Implementation Guidelines) for this field. Upper and lower case do not distinguish references, and only the basic Latin character set of letters without diacritics, digits and a few punctuation marks is allowed; a slash may not appear at the beginning or the end (EPC Implementation Guidelines).
This leads to three rules for the customer master. First, the mandate reference is its own field in a mandate table, not text in the order. Second, it is not built from parts that can change, such as the customer's name; umlauts and accents would fall outside the permitted character set anyway, as the article on special characters and field lengths shows. Third, one customer can have several mandates, for example for two accounts, and each mandate can carry several collections. The data model therefore needs the relationship customer, mandate, collection, and not a single IBAN field on the customer.
Recurrent mandates expire. If the creditor does not present a direct debit under a mandate for 36 months (EPC SDD Core Rulebook), the creditor must cancel it and may no longer use it. The period runs from the last collection presented, even if it was returned or refunded. Under the rulebook, banks are not required to check this rule; the obligation lies with the creditor alone (EPC SDD Core Rulebook). The ERP therefore keeps the date of the last collection per mandate and sets expired mandates to inactive itself. If a regular customer orders again after a long break, the shop obtains a new mandate.
| Field in the ERP | Content | Check at the interface |
|---|---|---|
| Mandate reference | unique per creditor identifier, at most 35 characters | character set, length, uniqueness regardless of case |
| Creditor identifier | merchant identifier, per company code if there are several entities | matches the company code of the receivable |
| Date of signature | time of consent at checkout | mandatory in the collection file |
| Sequence type | one-off or recurrent | matched against the type of mandate |
| Date of last collection | last direct debit presented | expiry after 36 months without collection |
| Status | active, revoked, expired, blocked | only active mandates go into the collection file |
Pre-notification and the collection file from the ERP
Before the ERP collects, the customer has to know when which amount will be debited. Under the rulebook, the creditor has to send this pre-notification at least 14 calendar days (EPC SDD Core Rulebook) before the due date, unless creditor and debtor have agreed on a different period. A shorter period therefore has to be agreed, for example in the shop's terms and conditions; the notice itself can be part of the order confirmation or the invoice. Technically, what matters is that amount and due date come from the same source as the collection file later on.
If the amount collected differs from the notice, that is a typical reason for a refund. The European Payments Council guidance on reason codes names a discrepancy between the announced and the collected amount as a possible root cause for code MD06 (EPC guidance on reason codes). This happens, for example, when an item is canceled after confirmation or a partial delivery is invoiced differently. If the amount changes, the customer needs a new notice; the article on order changes after the ERP export explains how to sync such changes cleanly.
The collection file itself is an ISO 20022 XML message. The implementation guidelines list it as message pain.008.001.08, which the creditor uses to transmit the collection to its bank (EPC Implementation Guidelines). For each debit it carries amount, due date, mandate reference, date of signature, IBAN and name of the payer, plus a reference of the merchant's own that is later used to match returns. As for timing, the payer's bank has to receive the debit no later than one bank business day before the due date and no earlier than 14 calendar days before it (EPC SDD Core Rulebook). How much lead time your own bank requires for submission is set out in your agreement with it.
For the sequence type, the rulebook lists the values one-off, recurrent, last in a series and, optionally, first in a series; a debit flagged as first is processed as a recurrent one (EPC SDD Core Rulebook). For a shop with regular customers, the recurrent mandate is practical because the customer gives it only once. It then has to live in the customer master, though, not in a single order.
There is a special rule for the payer's address. If the merchant's bank or the payer's bank is located in a SEPA country outside the European Economic Area, the address is mandatory (EPC SDD Core Rulebook). The European Payments Council originally planned to allow only structured or hybrid addresses from November 2026. In September 2026 (EPC SDD Core Rulebook) it postponed this date, and no new end date has been set yet. If you have such collections, you can still tackle the change now: an ERP that delivers street, postal code, town and country as separate fields is prepared for the structured format.
Notice and collection from one source
When the money comes back: return, refund, dispute
Returned debits are not all alike. The European Payments Council guidance groups the exceptions under the term R-transactions, because their names all start with R, from the reject before settlement to the refund (EPC guidance on reason codes). Two cases matter most to the merchant. The return comes from the payer's bank, for instance because the account lacks funds or has been closed; it must be settled no later than five bank business days (EPC SDD Core Rulebook) after the settlement date. The refund, on the other hand, is requested by the payer from his own bank.
The refund is governed by law. For SEPA Core and SEPA B2B direct debits, the payer has a claim to a refund against his bank without giving reasons (§ 675x(2) BGB), subject to a deviating agreement under subsection 3, which the section on B2B direct debit covers. The claim is excluded if the payer does not assert it within eight weeks (§ 675x(4) BGB) of the debit. The rulebook adopts this period and grants refunds within the eight weeks on a no-questions-asked basis (EPC SDD Core Rulebook). If the debit was unauthorized, for example because there was no valid mandate, the longer 13-month period of § 676b(2) BGB applies.
For the interface, this means a direct debit is not finally paid when the payment comes in. Anyone who ships goods against direct debit carries the risk for eight weeks, and longer if the mandate is missing. The incoming payment in the ERP should therefore carry a status that reflects this, instead of clearing the item for good the moment the money arrives.
Every returned debit comes with a reason as an ISO code. The European Payments Council guidance lists the codes with their root cause and the suggested reaction of the creditor (EPC guidance on reason codes). For the follow-up action in the ERP, the frequently cited codes can be grouped like this:
| Code | Meaning according to EPC | Follow-up in ERP and shop |
|---|---|---|
| AM04 | insufficient funds | reopen the item, inform the customer, collect again only by arrangement |
| AC04 | account closed | block the mandate, request new bank details |
| MD01 | no valid mandate; for B2B also: mandate not confirmed to the payer's bank | check the mandate evidence, block direct debit, pass the case to accounting |
| MD06 | refund requested by the payer, Core only | contact the customer, clarify the reason, block direct debit until resolved |
| MS02 | refused by the payer | contact the customer, agree on another payment method |
| MS03 | reason not specified | contact the customer, review the case manually |
Two notes from the guidance matter for matching. Code AC04 for a closed account may not be used in some SEPA countries for data protection reasons; MS03 may arrive there instead (EPC guidance on reason codes). And the payer can instruct the bank to block or limit direct debits entirely (EPC SDD Core Rulebook). A return can therefore also mean that the customer rejects direct debits from this creditor altogether; a second collection attempt is pointless then and only costs another fee.
From the bank statement back to the order and the customer account
The returned debit reaches the merchant through the electronic bank statement or a separate advice from the bank. From here, the interface decides whether the case continues automatically or sits on a list. The process has four steps:
- Import: The return is read from the bank statement, with amount, reason code, mandate reference and the merchant's own reference from the collection file.
- Match: Using the merchant reference, the ERP finds the original direct debit and with it the order and the invoice. The mandate reference serves as a second check, the payer's name does not.
- Book: The incoming payment is reversed, the open item is reopened and the bank charge is recorded separately.
- Report back: The ERP sets the direct debit block on the customer and reports it to the shop. There the payment method disappears at the next checkout, and open orders of the same customer are held for review.
Matching through a merchant reference of your own is the most important building block. Otherwise batch entries, partial returns and fees turn reconciliation into manual work; the pattern is the same as in payment reconciliation with the ERP. So that a return that is imported again after an error is not reversed twice, processing has to be idempotent: every return carries an ID that the ERP processes only once. What that looks like technically is shown in the article on idempotency and retry strategies.
The rules per reason code belong in a middleware configuration, not in scattered program code. An excerpt of what such a mapping can look like:
{
"AM04": { "reopenItem": true, "blockDirectDebit": true, "holdOpenOrders": true, "retry": "manual" },
"AC04": { "reopenItem": true, "blockDirectDebit": true, "deactivateMandate": true, "requestNewAccount": true },
"MD01": { "reopenItem": true, "blockDirectDebit": true, "deactivateMandate": true, "escalate": "accounting" },
"MD06": { "reopenItem": true, "blockDirectDebit": true, "holdOpenOrders": true, "contactCustomer": true },
"MS02": { "reopenItem": true, "blockDirectDebit": true, "contactCustomer": true },
"default": { "reopenItem": true, "blockDirectDebit": true, "escalate": "accounting" }
}What happens to the order itself depends on its status. If the goods have not shipped yet, the ERP holds the delivery until another payment is in place. If they are already with the customer, the order stays completed and the receivable goes into dunning. Do not automate the cancellation of orders that have already been delivered: it would invalidate invoice and delivery note even though the receivable still exists.
In the shop's customer account, the customer should see that a payment is open and be able to choose another payment method. The block itself does not need to be spelled out; it is enough that direct debit is no longer offered at checkout. When the block ends is up to the merchant, for example once the item is settled and after a few orders paid by other means. This rule belongs in the ERP and not in a shop extension, so that it also applies to orders placed by phone or through a marketplace.
Dunning and fees after a returned debit
A refund to the payer does not end the purchase contract. The rulebook states explicitly that a refund does not relieve the payer of the responsibility to resolve any disputes about the direct debit with the creditor (EPC SDD Core Rulebook). The receivable from the order therefore still exists, just without a payment. If the customer does not pay after a reminder issued once payment is due, the reminder puts him in default (§ 286(1) BGB). For business customers, additional rules on default interest and lump sums apply, which the article on net terms and early payment discounts in the B2B checkout describes.
Two things need to be kept apart when it comes to fees. A charge for the customer using SEPA direct debit as a payment method is invalid (§ 270a BGB); a surcharge for the payment method at checkout falls under this. The costs that a returned debit triggers at your own bank are a different matter. Whether and to what extent they can be passed on to the customer depends on the individual case, for example on whether the return was caused by insufficient funds. A flat fee in terms and conditions towards consumers is invalid if it exceeds the damage expected in the normal course of events or does not expressly allow the customer to prove that no damage, or substantially less damage, occurred (§ 309 No. 5 BGB).
The legal assessment belongs with legal counsel. The interface makes sure that the actual bank charge per return is booked separately and can be documented. In the ERP this means: the return fee as a separate posting referring to the return, a dunning level on the reopened item, and a flag showing that the receivable stems from a returned debit. Accounting needs this flag when it later decides whether a case goes to a collection agency. If postings are passed on to financial accounting, the returned debit should appear there as a transaction of its own, with a DATEV integration for example as a posting against the bank account with reference to the original invoice.
Core or B2B direct debit for business customers
For business customers, the SEPA B2B direct debit exists alongside the Core direct debit. Only non-consumers can be payers under it (EPC SDD B2B Rulebook), and it differs in the point that matters most to the merchant: the refund. Notably, § 675x(2) BGB expressly includes the B2B direct debit in the refund claim. The claim is excluded only by an agreement under subsection 3: the payer can agree with his bank that he has no refund claim if he gave his consent to the execution directly to his bank and, where agreed, was informed about the upcoming payment at least four weeks (§ 675x(3) BGB) before the due date.
The B2B direct debit implements exactly this agreement. The business customer confirms the mandate with its own bank, and under the rulebook the payer's bank is obliged to check the status of the mandate its customer signed (EPC SDD B2B Rulebook). For the merchant this means two things. A B2B direct debit that has been honored gives more planning certainty after the return period than a Core debit. And the mandate requires an extra step from the customer: the debit is honored only once the customer's bank knows the mandate. Under the B2B scheme, the payer's bank has three bank business days (EPC SDD B2B Rulebook) after the settlement date to return a debit.
| Feature | Core direct debit | B2B direct debit |
|---|---|---|
| Payer | consumers and businesses | non-consumers only |
| Refund without giving reasons | eight weeks after the debit | excluded by an agreement under § 675x(3) BGB |
| Mandate | held by the merchant | held by the merchant and confirmed to the payer's bank |
| Return by the payer's bank | up to five bank business days after settlement | up to three bank business days after settlement |
| Use in the shop | private customers and smaller businesses | business customers with recurring, larger amounts |
For the data flow this means: the type of mandate is a separate field in the ERP, and the shop offers B2B direct debit only to customer groups verified as businesses. If a B2B direct debit is submitted against a consumer account, it comes back with code AC13 (EPC guidance on reason codes). If the customer has not yet confirmed the mandate to the bank, the code is MD01 (EPC guidance on reason codes). Because the customer has to register the mandate with the bank, feedback in the customer account pays off: the mandate only counts as active once the first debit has been honored.
Setting up the data flow in five steps
Take stock
Where are mandates created today, where do IBAN and mandate reference live, who creates the collection file and who reads the bank statement? The answers show where returned debits get stuck today.
Define the data model
Create customer, mandate and collection as separate objects in the ERP, with status, date of signature, date of the last collection and type of mandate.
Checkout and handover
Capture IBAN and consent in the shop, version the mandate text and hand the data to the ERP through the middleware, without logging the IBAN in plain text.
Process returns
Import the bank statement, match through the merchant reference, define a rule per reason code and report the block to the shop.
Test and monitor
Run a test pass with test files for each reason code and add unmatched returns to the daily error list.
Where are mandates created today, where do IBAN and mandate reference live, who creates the collection file and who reads the bank statement? The answers show where returned debits get stuck today.
Create customer, mandate and collection as separate objects in the ERP, with status, date of signature, date of the last collection and type of mandate.
Capture IBAN and consent in the shop, version the mandate text and hand the data to the ERP through the middleware, without logging the IBAN in plain text.
Import the bank statement, match through the merchant reference, define a rule per reason code and report the block to the shop.
Run a test pass with test files for each reason code and add unmatched returns to the daily error list.
In our experience, collection is the smaller part of the work. The effort lies in the way back: your bank's statement format, special cases such as partial returns, and the question of which open orders to hold when a block is set. We plan this part from the start in a payment integration, usually as a separate component in the middleware, so that shop, ERP and accounting use the same rule. Which other interfaces we build is listed under services.
A Core direct debit stays provisional for eight weeks
Related Articles
Credit-Limit Checks in B2B Checkout: Live ERP Data
Check credit limit, open items and payment terms in real time from SAP, Dynamics or DATEV in the B2B checkout to control invoice purchase and order release.
Order changed after the ERP export: syncing it cleanly
Address, quantity or cancellation after the ERP export: how shop and ERP sync order changes with a picking lock, a change event, line matching and an audit log.
Fixing rounding differences between shop, ERP and e-invoice
Avoid cent gaps between shop, ERP and e-invoice: what EN 16931 rule BR-CO-17 requires, VAT per line or per total, discounts, leading system and test cases.