Skip to content
Shop integration & processes

Invoice from shop or ERP? Setting the leading system

Shop or ERP: which system issues the invoice and assigns the number? A decision matrix for partial delivery, cancellations, marketplaces and e-invoicing.

20 min read E-RechnungRechnungsnummerERP-AnbindungBelegfluss

As soon as shop and ERP are connected, a question arises that belongs in every specification: which system issues the invoice? Both can. The shop creates a PDF after checkout, the ERP invoices from the sales order. If both paths run in parallel, two documents come into being for the same delivery, and two counters increase independently of each other. German VAT law, however, requires a number that the issuer assigns once to identify the invoice (Section 14(4) no. 4 UStG). And if several invoices have been issued for the same supply without being marked as a duplicate or copy, the business owes the tax shown in them (UStAE 14c.1 para. 4). This article deals with the architecture decision behind it: which system leads for which document type, how partial delivery, cancellation, marketplace and self-billing affect the choice, and why the e-invoice is only one of several criteria. How the inventory system is connected to the shop determines which data is available at the place where the invoice is created.

Key takeaways

  • The issuer of the invoice assigns the invoice number once (Section 14(4) no. 4 UStG). Several number ranges are permitted as long as every invoice can be assigned unambiguously to its range (UStAE 14.5 para. 11).
  • Two invoices for the same supply that are not marked as duplicate or copy trigger the tax shown on them (UStAE 14c.1 para. 4). That is why exactly one system issues per order and document type.
  • A correction refers to the number of the original invoice (UStAE 14.11 para. 1). Cancellations and corrections are created in the system that issued that invoice and knows its line items.
  • For domestic B2B supplies from 2027, the transitional rule for paper and other formats only applies up to EUR 800,000 prior-year turnover (Section 27(38) UStG). Above that, the issuing system must produce e-invoices under EN 16931 unless EDI is used with consent.
  • With partial deliveries, the supply date per shipment belongs in the invoice (Section 14(4) no. 6 UStG). For marketplace self-billing, the issuer of the self-billed invoice assigns the number (UStAE 14.5 para. 13).

What the invoice number requires

Under German VAT law, an invoice is any document used to bill a supply of goods or services, regardless of what the document is called in business dealings (Section 14(1) UStG). For the architecture, this sentence matters more than it sounds. Whether the shop calls its PDF “purchase receipt”, “order summary” or “invoice” does not decide whether it is an invoice. If the document shows the price and the tax for delivered goods and goes to the customer, classifying it as an invoice is the obvious reading. Anyone who additionally sends an invoice from the ERP has then put two billing documents for the same transaction into circulation.

The invoice number is one of the mandatory details. The law requires a sequential number based on one or more series of numbers, assigned once by the issuer to identify the invoice (Section 14(4) no. 4 UStG). Three terms in it carry the architecture question: “once”, “issuer” and “one or more”. Once means that no number may occur twice, not even in two different systems of the same company. The issuer is whoever creates the invoice, and therefore also whoever draws the number. And “one or more series” explicitly allows shop and ERP to keep their own ranges, as long as they do not overlap.

The tax administration spells this out in the VAT Application Decree (UStAE). It is left to the issuer how many and which separate number ranges are created, in each of which an invoice number is assigned only once; ranges for areas separated by time, geography or organisation are permitted (UStAE 14.5 para. 11). It must be ensured, however, that every invoice can be assigned easily and unambiguously to its number range and that the number is unique. In practice, this means one prefix per issuing system or channel, such as RS for shop invoices and RE for ERP invoices, and no two counters serving the same prefix.

A gapless sequence of the invoice numbers issued is not mandatory.

VAT Application Decree (UStAE), section 14.5 para. 10, own translation

Gaps are therefore not a formal error. They should still be explainable, because a machine-generated range with unexplained gaps can raise questions in a tax audit. Between shop and ERP, gaps typically arise where one system reserves a number and the process then aborts, for example because the hand-over to the ERP fails. If the number is only assigned when the document is actually created and aborted attempts are logged, every gap can be accounted for. There is an exception for small amounts: small-amount invoices up to EUR 250 (Section 33 UStDV) need no sequential number (UStAE 14.5 para. 14). However, this simplification of the small-amount invoice does not apply to distance sales under Section 3c UStG (Section 33 UStDV), and many shops also deliver to consumers in other EU countries.

Two issuers, one order: how duplicates arise

The typical picture in grown landscapes: the shop creates an invoice after payment in advance or via a payment service, because the customer expects a receipt immediately. The ERP creates another one on dispatch, because invoicing there has been tied to the delivery note for years. Both documents show VAT, both carry a number, and both reach the customer. For the tax administration, the case is settled: if several invoices have been issued for one and the same supply without being marked as duplicate or copy, the supplier owes the tax amount shown separately in them (UStAE 14c.1 para. 4). The basis is the incorrect tax statement, under which the business also owes an excess amount (Section 14c(1) UStG).

Identical copies of the same invoice, on the other hand, are harmless. The file of an e-invoice may also be sent several times, as long as it is the same invoice and only an identical copy is transmitted (UStAE 14c.1 para. 4). The line is therefore not between one and two transmissions but between one and two invoices. A PDF that the shop renders from its own data while the ERP writes the actual invoice is no longer a copy once an amount, a date or the number differs.

  • Same prefix in two systems. Shop extension and ERP both count in the range RE-2026 and at some point assign the same number – the “same number twice” from the diagram above.
  • Reset at the turn of the year. Both sides start again on 1 January, but not in step. How ranges can be separated at the cut-off date is described in the article on stocktaking and year-end.
  • Retry after a timeout. The interface reports an error although the ERP has already created the invoice; the second attempt creates another one. Idempotency keys per order and document type remedy this.
  • Emergency mode without a rule. If the ERP fails, someone writes invoices manually in the shop, and the ERP invoices the same orders again after the restart. A planned emergency mode defines beforehand who invoices during that time.
  • Deviating image part. With hybrid formats, a PDF part that carries different invoice details than the structured part can constitute a further invoice for which Section 14c UStG has to be examined (BMF letter of 15 Oct 2025).

One delivery, two tax amounts

Anyone who currently lets shop and ERP write invoices in parallel should not wait for the next migration. First establish which documents customers have actually received; then each surplus invoice is corrected by its issuer. How an incorrectly stated tax amount is corrected is governed by Section 14c(1) UStG with its reference to Section 17(1) UStG. The assessment of the individual case belongs with your tax adviser.

Defining the leading system per document type

The solution is not a system choice on a grand scale but a decision per document type. For order, order confirmation, delivery note, invoice, invoice correction and self-billed credit note, it is laid down in writing which system creates the document and assigns the number. The other system takes over the number as a foreign key, displays it and, where needed, sends an identical copy, but does not create a second document itself. The same principle applies to master data; how a leading system resolves conflicts between ERP and shop is described in the article on bidirectional synchronisation.

For the invoice, there are three viable set-ups and one that does not hold. Which one fits depends less on taste than on where the data lies that an invoice needs: customer master with VAT identification number, tax determination, payment terms, shipments and supply data. The table puts the three set-ups side by side.

CriterionShop issuesERP issuesSplit by channel
Time of invoicingon order or paymenton dispatch or in a batch rundefined per channel
Data basisbasket, payment, customer accountsales order, delivery note, customer masterper channel the system holding the data
Partial deliveryonly with shipment data from the ERPinvoice per delivery noteper delivery note in the ERP channel
Cancellation and correctionin the shop, referencing the shop numberin the ERP, referencing the ERP numberwith the original issuer
E-invoice for B2Bshop must produce EN 16931ERP or middleware produces itfrom the ERP in the B2B channel
Number rangeown prefix, ERP importsown prefix, shop displaysone prefix per channel
FitsB2C with same-day dispatchB2B, partial delivery, stock businessmixed B2B and B2C business

The fourth set-up – both systems write, depending on who comes first – is often the starting point of a clean-up project in practice. It rarely arises on purpose, but through a shop extension that sends an invoice after checkout and an ERP configuration that nobody adjusted when the integration was built. Split by channel, by contrast, does not mean that two systems may bill the same order. The boundary runs along the channel or the customer group, and every single order falls clearly on one side.

The decision matrix: six questions

The matrix does not replace a conversation with your tax adviser, but it sorts the questions that should be answered before the decision. Each question targets a piece of data or an obligation that only one of the two systems knows reliably.

Customer group

Do you sell to businesses, to consumers or to both? Towards businesses the invoice is mandatory; towards consumers it is usually optional for sales of goods (Section 14(2) UStG).

Time of invoicing

Do you bill on payment, on dispatch or in a batch run? The time of supply belongs in the invoice; the calendar month is sufficient (Section 31(4) UStDV).

Partial delivery

Does an order split into several shipments? Then it makes sense for the system that knows the shipments to bill – usually the ERP with its delivery notes.

Cancellation and correction

Where does the original invoice live? The correction refers to its number and must meet the formal requirements of an invoice (UStAE 14.11 para. 1).

Marketplace and self-billing

Does a marketplace or a third party issue documents? With self-billing, the issuer of the self-billed invoice assigns the sequential number (UStAE 14.5 para. 13).

Format and archive

Can the system produce e-invoices under EN 16931 and keep the copy readable for eight years (Section 14b UStG)?

If most answers point to the ERP, the ERP issues. If only the customer group speaks for the shop, for instance because consumers expect a receipt right after the purchase, the shop can issue for that channel – with its own range and a clear boundary. The following sections go through the six questions one by one.

B2B and B2C: obligation or option

A business that makes a supply is entitled to issue an invoice. It is obliged to do so if it supplies another business for its business or a legal person; the invoice must then be issued within six months of the supply (Section 14(2) UStG). If the supply goes to another business and both are established in Germany, it must be issued as an electronic invoice. When ordinary goods are sold to consumers, there is no obligation to invoice. If an invoice is issued anyway, an e-invoice may only be used with the recipient's consent (BMF letter of 15 Oct 2025).

For the architecture, this means: in B2C business the invoice is a service that should arrive quickly, and the shop knows basket, payment and email address. In B2B business it is an obligation with a deadline and a format, and the details for it usually lie in the ERP: debtor account, VAT identification number, payment terms, a different billing address and the customer's purchase order reference. How tax rates and reverse charge cases get from the ERP into the shop is described in the article on tax determination in the B2B shop.

Across borders it gets tighter. For an intra-community supply, the invoice must be issued by the fifteenth day of the month following the month of the supply, and it must show the VAT identification numbers of both parties (Section 14a(3) UStG). A shop that accepts B2B orders from other member states must therefore either keep the customer's verified number itself or leave the invoice to the ERP, which holds it in the debtor account. Anyone who mixes both ends the month with a list of open orders for which nobody knows which system monitors the deadline.

Partial delivery and the time of supply

Every invoice states the time of the supply of goods or services (Section 14(4) no. 6 UStG); the calendar month in which the supply is made may be given (Section 31(4) UStDV). A shop that bills at the time of the order does not know this date yet, it only knows the planned dispatch. For stock items shipped the same day, that is not critical. But if an order is split into two shipments several weeks apart, each invoice needs the month of its shipment.

If the price is collected before delivery, for instance through payment in advance, the invoicing rules apply accordingly, and a later final invoice must deduct the partial payments received in advance together with their tax if invoices were issued for them (Section 14(5) UStG). Anyone who writes an invoice in the shop on payment and the next one in the ERP on dispatch thus ends up with an invoice for an advance payment and a final invoice – only without the deduction. The document chain for partial deliveries and part invoices can therefore usually be kept cleanest where the delivery notes are created.

The invoice type belongs to the issuer

In field BT-3, XRechnung provides among others the codes 326 (Partial invoice), 380 (Commercial invoice), 384 (Corrected invoice), 389 (Self-billed invoice) and 381 (Credit note) (KoSIT). Which code is set is decided by the issuing system. That is another reason why it must know the whole transaction: delivery, partial quantity, reason for the correction and reference.

Cancellation, correction and self-billing

An issued invoice is neither deleted nor overwritten. An entry or record may not be altered in such a way that its original content can no longer be determined (Section 146(4) AO). A correction is made by a document that refers specifically and unambiguously to the invoice (Section 31(5) UStDV). This is regularly the case if the document states the sequential number of the original invoice; a new invoice number for this document is not required (UStAE 14.11 para. 1).

Legally, the issuer of the invoice is the company, not the software. A correction can only be made by the issuer of the invoice (UStAE 14.11 para. 2) – for the shop and the ERP of the same retailer, that is the same company in both cases. Technically, however, the reference requirement leads to a clear rule: the correction is created in the system that knows the original invoice, its number and its line items. An ERP that cancels a shop invoice would have to take over the number, date and amounts of the shop invoice instead of deriving a new document from its own sales order. For e-invoices, the correction must also be made in the prescribed form using the corresponding invoice type (UStAE 14.11 para. 1). In XRechnung, field BT-25 carries the identifier of the preceding invoice that is referred to (KoSIT).

document-types.yaml
# Ownership per document type: exactly one issuer, the other system only reads
order:
  issuer: shop
  number_range: "B-{YYYY}-{n}"
invoice_b2c:
  issuer: shop
  number_range: "RS-{YYYY}-{n}"
  erp_imports: [number, date, lines, tax]
invoice_b2b:
  issuer: erp
  number_range: "RE-{YYYY}-{n}"
  format: xrechnung            # EN 16931
  shop_displays: [number, pdf, xml]
correction:
  issuer: same_as_original     # not the other system
  reference: original_number   # BT-25 in XRechnung
  type_code: 384
self_billing_marketplace:
  issuer: marketplace
  number_range: assigned_by_issuer
  erp_imports: true            # import, do not re-invoice

The word “Gutschrift” is a special case in German. For VAT purposes, a Gutschrift is a self-billed invoice that the recipient issues under a prior agreement (Section 14(2) UStG), and it must carry the term “Gutschrift” (Section 14(4) no. 10 UStG). The commercial credit note for a return is something else: it corrects your own invoice. The mere label “Gutschrift” does not by itself trigger Section 14c UStG (UStAE 14c.1 para. 3). For clean data, it is still worth keeping both document types separate so that the returns process creates the right one; how returns run between shop and ERP is described in the article on the RMA process.

Marketplaces and third parties as issuers

With marketplace sales, the invoice often lies neither in the shop nor in the ERP. The law allows an invoice to be issued by a third party in the name and on behalf of the business (Section 14(2) UStG). If the retailer uses such a third party, it has to ensure that the third party complies with the formal requirements of Sections 14 and 14a UStG (BMF letter of 15 Oct 2025). If the invoice is issued by a third party, that party may assign the sequential number; in the case of self-billing, the issuer of the self-billed invoice assigns it (UStAE 14.5 para. 13).

For the integration, this means: marketplace documents are imported, not rebuilt. The ERP takes over number, date, line items and tax as an external document in its own, recognisably separate range and does not write its own invoice for the same order. Corrections are made where the document was issued; if a third party was commissioned, the supplier itself may also correct, and in the case of self-billing the issuer of the self-billed invoice (UStAE 14.11 para. 2). How marketplace orders reach the inventory system via middleware is described in the article on marketplace integration.

E-invoicing from 2027: one criterion among several

An electronic invoice is an invoice that is issued, transmitted and received in a structured electronic format and enables electronic processing (Section 14(1) UStG). Formats that comply with the European standard EN 16931 are permitted; their use is not restricted to national formats (BMF letter of 15 Oct 2025). The transitional rules expire in stages. For supplies until the end of 2026, invoices may still be sent on paper or, with the recipient's consent, in another electronic format. For supplies in 2027 this only applies if the issuing company's total turnover in the previous year did not exceed EUR 800,000; EDI procedures remain permitted with consent until the end of 2027 (Section 27(38) UStG).

Whoever issues the invoice must therefore master the format. A shop that has so far rendered a PDF needs a route to XRechnung or a hybrid format for domestic B2B customers. With a hybrid format, the invoice data in the structured part forms the leading part; in the event of deviations it takes precedence over the image part (BMF letter of 15 Oct 2025). The specification describes the invoice number in field BT-1 as a unique identifier that identifies the invoice in the seller's system (KoSIT). For the architecture, this means the number comes from the system that issues – not from the one that later passes the file on.

The format keeps evolving. The preliminary version of the XRechnung 4.0 specification was published in September 2026, and the final version is expected to be published in spring 2027 (KoSIT). The issuing system has to follow such version changes, and that is a decision criterion of its own: if the ERP is old and the shop is young, middleware can also produce the e-invoice from the ERP data within the ERP's number range. Which formats and deadlines apply in detail is covered in the article on the e-invoice mandate 2027; how we approach implementation from ERP and shop is described on the e-invoicing page.

Archive, payment and evidence

Retention begins with issuing. The business must keep a copy of every invoice it has issued itself or that a third party has issued in its name for eight years (Section 14b UStG); the same period applies to accounting vouchers (Section 147(3) AO). If the shop writes the invoice, the copy is a record in the shop. It must then remain readable and unchanged for just as long, even when customer accounts are deleted or shop versions change. How deletion obligations and retention fit together across system boundaries is covered by the deletion concept for shop, ERP and accounting.

Payment also depends on the number. Incoming payments are most reliably matched via invoice or order number; if the ERP writes the invoice, the shop's order number must be in the invoice record, otherwise payment reconciliation cannot find the bridge. The same applies to accounting: a DATEV integration should take documents from exactly one source per document type. The decision belongs in the process documentation; which points it should cover for interfaces is shown in the article on GoBD process documentation.

The switch in five steps

Moving to a leading invoicing system is usually not a large migration project, but it needs an order of steps. Switching off the shop invoice first and configuring the ERP afterwards leaves a window without documents; doing it the other way round leaves one with duplicates.

From parallel invoicing to a leading invoicing system

  1. 1

    Take stock

    List every place that creates documents today: shop core, extensions, email templates, ERP runs, marketplace accounts. For each, record which document type is created in which range.

  2. 2

    Define ownership

    Determine exactly one issuer per document type and channel and record it in writing. The decision matrix provides the reasoning.

  3. 3

    Separate the ranges

    Give each issuer its own prefix and shut down counters that serve the same prefix. The range must be recognisable on the document.

  4. 4

    Build the return channel

    Number, PDF and, where applicable, XML flow from the issuer to the other system, into the customer account and into the dispatch email. The shop displays the invoice instead of recreating it.

  5. 5

    Switch on a cut-off date

    Switch at the start of a month. Corrections to older invoices continue to be created where the original invoice was issued.

Testing uses the awkward cases, not the normal case: a partial delivery across the turn of the month, a cancellation after a partial return, a marketplace order with self-billing, a B2B order from another member state and a retry after a timeout. Only when none of these cases produces two invoices does ownership really lie with one system.

An invoice has exactly one issuer. Everything else the interface does with it is transport.

Principle of document architecture
This article is based on data from: German VAT Act (Sections 14, 14a, 14b, 14c and 27(38) UStG) and VAT Implementing Ordinance (Sections 31 and 33 UStDV) in the version published on gesetze-im-internet.de, Fiscal Code (Sections 146 and 147 AO), VAT Application Decree (UStAE) as of 19 December 2025 (sections 14.5, 14.11 and 14c.1), the BMF letter of 15 October 2025 on the introduction of mandatory e-invoicing, and the XRechnung 3.0.2 specification and version overview published by KoSIT. Quotations in this English version are our own translations of the German texts. This overview does not replace tax advice.

Related Articles

Shop integration & processes

Hazardous Goods Data from the ERP into the Shop

Transferring hazard fields from section 14 of the safety data sheet into the shop: field list, quantity totals in the cart, labelling in the offer and handover to the shipping interface.

15 min read
Shop integration & processes

Daylight Saving Time: Timestamps in ERP Interfaces

On changeover night one hour occurs twice. How timestamps, delta queries and job schedules between shop and ERP stay unambiguous, plus a test plan for October.

15 min read
Shop integration & processes

Blanket Orders and Call-Offs in the B2B Shop

Blanket orders and call-offs between shop, middleware and ERP: data model, remaining quantity, contract price, contract term and the way into the document.

15 min read