Nobody adopts mandatory electronic invoicing because they want better cost data. It arrives as a compliance project, it is run by tax and IT, and finance mostly hopes it will not break the month-end. But once the files exist, they are the cleanest driver source a cost model will ever get, for a reason that has nothing to do with costing: a tax authority has already validated every one of them, rejected the malformed ones, and required fields that an ERP export would have left blank. An invoice count per customer from an e-invoicing archive is a count I trust more than the same count from a sales report, because nobody with the power to fine the company ever checked the sales report. What differs between the regimes is how much beyond the count you get with no extra work, and that is what this article compares.
Which cost-to-serve drivers can you take from mandatory e-invoicing files, and how do the regimes differ?
Every regime gives you the invoice count, the line count, the customer, the date and the amounts, which already covers the order desk, invoicing and collections drivers. Beyond that they differ. Brazil’s NF-e carries a transport block with freight responsibility, volumes and weights, plus product classification and operation codes that make returns visible. Mexico’s CFDI carries the payment method and terms, a separate payment complement that records each collection event, and a transport complement for the shipment legs. The Portuguese SAF-T, and the other national files built on the same standard, adds the general ledger and the product master, so the resource side and the driver side sit in one file. Spain’s Verifactu is a header-level record with the tax breakdown and the invoice type, generally without lines. The EU’s ViDA will standardise a line-level structured invoice for intra-community business from 2030, with national mandates arriving earlier. None of them gives you time; all of them give you volumes.
What every regime shares
Whatever the country, a compliant electronic invoice identifies the issuer and the customer by a tax number, carries a sequential number and a date, states the totals and the tax, and is either signed, hashed, or registered with the authority before or shortly after it is issued. From that alone a model gets four drivers: invoices per customer per period, the share of credit notes and corrections, the average invoice value, and the customers billed at all. The first look at cost per invoice and complaint shows what those four do to a margin by customer once a rate is applied. Where the format carries lines, and most do, you also get lines per invoice, which is usually the strongest single driver of order-desk and invoicing time in the models we build, and units per line.
| Field present in all five | Driver it feeds | Pool it usually moves |
|---|---|---|
| Customer tax number | Invoices per customer | Invoicing, credit control |
| Invoice type or correction flag | Credit notes and rectifications per customer | Order desk, customer service |
| Date and number | Invoices per period, billing frequency | Invoicing |
| Totals and tax breakdown | Average invoice value, small-invoice share | Invoicing, collections |
NF-e, Brazil: the logistics regime
The Brazilian NF-e for goods has been mandatory for most businesses for well over a decade and is, in my experience, the richest of the five for a cost-to-serve model, because it was designed to follow the goods rather than only the money. The layout carries a transport group with the freight modality, meaning who is responsible for the freight, the carrier, and the volumes with their count, gross and net weight, which is most of what a transport time equation needs before the TMS is opened. Each item carries a product classification code and an operation code that distinguishes a sale from a return, a transfer, a consignment or a sample, so the returns and the internal movements that cost the warehouse time are visible without a separate extract. A referenced invoice field links a return or a correction to the original document. Services are invoiced under a separate municipal document, and a company that sells both needs both files. I would treat the tag names as things to read from the current layout rather than from this article; the structure has been stable, the versions have not.
CFDI, Mexico: the payment behaviour regime
The Mexican CFDI, in the version current at the time of writing, is a line-level XML validated by a certified provider before it is valid, and it carries two things the other regimes mostly do not. The first is payment: a field for the form of payment and another for the method, which distinguishes payment in a single instalment from payment in instalments or deferred, and for the deferred case a separate payment complement is issued each time money arrives, referencing the invoices it settles. That complement is a log of collection events per customer, which is exactly what a credit control time equation wants and what an accounts receivable ageing only approximates. The second is transport: a transport complement, required for the movement of goods on public roads, that describes the legs, the vehicle and the goods, and gives a cost model the shipment count and the route shape per customer without going near the TMS. Cancellations carry a reason code, which turns rework into a countable driver.
Verifactu, Spain: the header regime
Spain’s Verifactu is a different kind of thing, and a cost model that expects lines from it will be disappointed. It is a requirement on invoicing software to produce, for every invoice, a registration record with a hash chained to the previous one, sent to the tax agency or kept for inspection, and the record carries the header: the parties, the number, the date, the invoice type, and the tax breakdown by rate and regime. Line items are not part of the record in the form I have seen described. It applies to businesses not already reporting through the immediate supply of information system, which is itself a header-level near-real-time feed. What the model gets is the invoice count, the correction count by type, since rectifying invoices carry their own type codes, and the tax composition, which is a fair proxy for the mix of goods and services. The compliance deadlines have moved more than once and I am not going to quote one here; the structure of the record is what matters for a cost model, and that has been stable.
ViDA, European Union: the regime that arrives in stages
The VAT in the Digital Age package was adopted in 2025 after a long negotiation, and the part that matters here is the digital reporting requirement: from mid-2030, intra-community business-to-business transactions are to be reported through structured electronic invoices that conform to the European e-invoicing standard, with a short reporting window after issue. Member states may mandate structured e-invoicing for domestic transactions without asking for a derogation, and several have done so or announced it: Italy has run a clearance system for years, Poland, Belgium, France and Germany are at different points on their own timelines, and the dates have shifted in more than one country. What a model gets from the European standard is a line-level invoice with buyer and seller references, item identifiers, quantities, unit prices, delivery information and payment terms, in a syntax that is the same across the member states that adopt it. For a company selling into several EU countries that is the first time the driver file will look the same everywhere, and I would build the extraction for the standard rather than for any one national flavour. The cost to serve by channel article shows what a consistent invoice line feed does for a multi-country margin view.
SAF-T, Portugal and the OECD family: the whole-model regime
The standard audit file for tax is an OECD schema from the mid-2000s that a number of countries adopted and adapted, Portugal most thoroughly. The Portuguese file comes in an invoicing form submitted monthly and an accounting form used with the annual return, and what makes it different from the four above is scope: the master files for customers, suppliers, products and the chart of accounts, the general ledger entries, and the source documents, sales invoices with their lines, stock movements, working documents and payments, all in one schema. For a cost model that is unusual, because the resource side, the ledger, and the driver side, the invoice lines and the payments, arrive together and reconcile by construction. Other countries in the family, Norway, Poland, Lithuania, Romania among them, adopted different subsets and different cadences, so a group with subsidiaries in several of them gets a family resemblance rather than one file. The article on reusing the same data for sustainability reporting makes a related point from the other direction.
The five side by side
| What the model wants | NF-e | CFDI | Verifactu | ViDA standard | SAF-T (PT form) |
|---|---|---|---|---|---|
| Invoice header and totals | Yes | Yes | Yes | Yes | Yes |
| Line items with quantities | Yes | Yes | Generally no | Yes | Yes |
| Returns and corrections identifiable | Yes, by operation code and reference | Yes, by type and cancellation reason | By invoice type only | By type and reference | By type and reference |
| Transport and logistics fields | Yes, in the document | Yes, via the transport complement | No | Delivery information | Stock movement documents |
| Payment behaviour | Payment method on the document | Yes, via the payment complement | No | Payment terms | Payments file |
| General ledger and product master | No | No | No | No | Yes |
| Coverage | Goods; services separate | Goods and services | Businesses outside the real-time feed | Intra-EU B2B from 2030; domestic by country | All invoicing businesses |
The table is a simplification, and I would not defend every cell against every version and every country adaptation. It is right about the shape: two regimes were designed to follow goods and money, one was designed to follow the ledger, one was designed to secure the header, and one is a standard that the others will partly converge on.
What none of them gives you
Time. An invoice line says a thing was sold, not that the order took eleven minutes to key, three calls to confirm and a credit note to fix. The minutes come from a time equation, and the equation’s coefficients come from observation or from operational logs; the article on WMS, TMS and MES logs covers the second route. Nor do the files see work that was not invoiced: the quote that lost, the order cancelled before shipment, the visit that produced nothing. Those are real cost-to-serve drivers, they live in the CRM and the order system, and a model built only on invoices will flatter the customers who make the sales team work hardest for nothing.
A tax authority has already validated every one of these records. That makes them the most trustworthy driver counts a cost model will get, and the least likely to contain the time.
How to use it in a month
Take one closed month of the archive, parse the headers and the lines into a table, and count per customer: invoices, lines, corrections, and whatever the regime adds, shipments, payment events, returns. Join the counts to the resource pools that handle each, apply a rate, and compare the result with the gross margin by customer the sales team already believes. The how to calculate cost to serve page has the sequence. If the two agree, the invoice file has confirmed something cheaply. If they do not, which is the usual outcome the first time, you have a list of customers to look at, built from records nobody can argue with. Either way it is a few days of work from files the company was obliged to keep anyway, and I would rather a company start there than wait for a data project.
Related reading: cost to serve versus gross margin, twelve signs a company needs cost-to-serve analysis, the cost driver library and order frequency and its cost.
Sources
The official page for each regime, for a reader who needs the current layout, schema or deadline rather than the summary above. Layouts and dates change, and these are the pages where the change is published first.
- NF-e, Brazil: Portal da Nota Fiscal Eletrônica, the national NF-e portal, with the taxpayer manuals, XML schemas and technical notes.
- CFDI, Mexico: Servicio de Administración Tributaria (SAT), Formato de factura (Anexo 20), the technical standard for version 4.0 of the electronic invoice.
- Verifactu, Spain: Agencia Tributaria, Sistemas Informáticos de Facturación (SIF) y VERI*FACTU, with Real Decreto 1007/2023 and the current adaptation deadlines.
- ViDA, European Union: European Commission, Taxation and Customs Union, VAT in the Digital Age (ViDA).
- SAF-T, Portugal: Autoridade Tributária e Aduaneira, SAF-T PT (Standard Audit File for Tax purposes), Versão Portuguesa.
- SAF-T, OECD: OECD Forum on Tax Administration, Guidance for the Standard Audit File - Tax Version 2.0, April 2010.
