INVOIC — Invoice Message (D.96A)
The INVOIC message carries the commercial invoice from a seller to a buyer: gross amounts, taxable base, payment terms, references to the order and the despatch advice.
Purpose
Per the official UN/CEFACT definition, INVOIC is "intended to claim payment for goods or services supplied under conditions agreed between the seller and the buyer". In practice, INVOIC handles the classic commercial invoice as well as credit notes, consolidated multi-delivery invoices, self-billing scenarios, and pro-forma invoices. The BGM[1] function code (380 = commercial invoice, 381 = credit note, 384 = corrective invoice...) signals the kind.
Segment structure
A D.96A INVOIC message has three sections: a Header, a Detail (repeatable SG25 group, up to 9,999,999 lines per interchange), and a Summary. The structure is denser than ORDERS — taxes, currencies, and payment terms are systematically present.
Header
Mandatory header segments: UNH M , BGM M , and DTM M . Other header segments are conditional: PAI C , ALI C , IMD C , FTX C .
Then segment groups SG1 through SG24, in this exact order: SG1 RFF+DTM
(references — including the order number, the despatch number, the contract), SG2
NAD+LOC+FII (parties — seller, buyer, ship-to, payer), SG3
RFF+DTM (references attached to a party), SG4 DOC+DTM
(associated documents), SG5 CTA+COM (contacts), SG6 TAX+MOA+LOC
(header-level taxes), SG7 CUX+DTM (currencies and FX rates), SG8
PAT+DTM+PCD+MOA+PAI+FII (payment terms), SG9 TDT (transport),
SG10 LOC+DTM (locations), SG11 RFF+DTM, SG12
TOD+LOC (delivery terms), SG13 PAC+MEA (packaging), SG14
PCI+RFF+DTM+GIN (package identification), SG15 ALC+ALI with
nested SG16-SG21 (RFF+DTM, QTY+RNG, PCD+RNG,
MOA+RNG, RTE+RNG, TAX+MOA) for header-level
allowances/charges, SG22 RCS+RFF+DTM+FTX (requirements), SG23
AJT+FTX (adjustment), SG24 INP+FTX (party instructions).
Detail (line item)
The Detail section sits entirely inside SG25, a loop built around the LIN M segment. Each line can carry PIA , IMD , MEA , QTY , PCD , ALI , DTM , GIN , GIR , QVR , EQD , and FTX .
Beyond LIN itself, 22 nested groups describe line-level concerns: line monetary
amounts (SG26 MOA+CUX), line-specific payment terms (SG27
PAT+DTM+PCD+MOA), pricing (SG28 PRI+APR+RNG+DTM), references
(SG29 RFF+DTM), packaging (SG30 PAC+MEA) with its nested
SG31 PCI+RFF+DTM+GIN, location/quantity per site (SG32
LOC+QTY+DTM), line taxes (SG33 TAX+MOA+LOC), line-specific
parties (SG34 NAD+LOC) with nested SG35-SG37 (RFF+DTM,
DOC+DTM, CTA+COM), line allowances/charges (SG38
ALC+ALI+DTM) with nested SG39-SG43 (QTY+RNG,
PCD+RNG, MOA+RNG, RTE+RNG, TAX+MOA),
line transport (SG44 TDT) and SG45 LOC+DTM, line delivery
terms (SG46 TOD+LOC), line requirements (SG47
RCS+RFF+DTM+FTX).
The spec permits up to 9,999,999 repetitions of the SG25 loop per interchange — a ceiling rarely reached, but it enables annual consolidated invoices from large telco or energy suppliers.
Summary
The Summary section contains: UNS M , CNT , then a mandatory group SG48 ( MOA M ) with its nested SG49 ( RFF + DTM ) and SG50 ( TAX + MOA ), then SG51 ( ALC + ALI + MOA ) for global allowances/charges, and finally UNT M .
Mandatory / conditional
Four segments are strictly mandatory in every D.96A INVOIC:
UNH, BGM, UNS+S, UNT. The SG48
totals group (MOA) is also mandatory — that's INVOIC's
signature difference vs ORDERS.
UNH— opens the message, carries the reference and the version.BGM— gives the function code (380 = commercial invoice, 381 = credit note), the invoice number, and the document status.UNS+S— separates Detail from Summary.SG48 MOA— at least one monetary total (gross amount or net amount).UNT— closes the message, declares the segment count.
On top of those, at least one DTM+137 (invoice date) plus
NAD+SU and NAD+BY identifying seller and buyer. Industry
subsets (EANCOM in retail, Galia in automotive) add the obligation to reference the
order (RFF+ON) and the despatch advice (RFF+DQ).
Real-world example
A typical retail invoice between a manufacturer (seller) and a buying group (buyer), for two products delivered through the reference DESADV:
UNB+UNOC:3+5410000000456:14+5410000000123:14+260601:1000+CTRL000003'
UNH+1+INVOIC:D:96A:UN:EAN008'
BGM+380+INV-2026-1042+9'
DTM+137:20260601:102'
DTM+35:20260520:102'
RFF+ON:ORDER789'
RFF+DQ:DESADV-2026-0521'
NAD+SU+5410000000456::9'
NAD+BY+5410000000123::9'
CUX+2:EUR:4'
PAT+1++5:3:D:30'
LIN+1++3520000001234:EN'
QTY+47:2'
MOA+203:1698.00'
PRI+AAA:849.00'
TAX+7+VAT+++:::20'
MOA+125:1698.00'
LIN+2++3520000005678:EN'
QTY+47:5'
MOA+203:97.50'
PRI+AAA:19.50'
TAX+7+VAT+++:::20'
MOA+125:97.50'
UNS+S'
MOA+79:1795.50'
MOA+125:1795.50'
MOA+150:359.10'
MOA+9:2154.60'
TAX+7+VAT+++:::20'
MOA+124:359.10'
UNT+30+1'
UNZ+1+CTRL000003' BGM+380+INV-2026-1042+9— type 380 (commercial invoice), number INV-2026-1042, status 9 (Original).DTM+137— invoice date.DTM+35— actual delivery date.RFF+ONandRFF+DQ— references to the order (ORDER789) and the despatch advice (DESADV-2026-0521).CUX+2:EUR:4— invoicing currency (EUR, qualifier 4 = invoicing currency).PAT+1++5:3:D:30— payment terms: 3% discount within 5 days, net 30 days.- Two
LINwith QTY+47 (invoiced quantity), MOA+203 (line net amount), PRI+AAA (net unit price), TAX+7 (VAT 20%), and MOA+125 (taxable amount). - Summary: MOA+79 (line total), MOA+125 (taxable base), MOA+150 (tax payable), MOA+9 (total payable), TAX+7 + MOA+124 (tax detail).
UNT+30+1— 30 segments in the message, reference "1" matching UNH.
Common errors
- Totals coherence — MOA+9 (total payable) in the summary must equal MOA+125 (taxable base) + MOA+150 (total tax). It's the single most-filtered control on the buyer's side.
- Missing reference to the order — an INVOIC without
RFF+ONis auto-rejected by 100% of retail e-invoicing platforms (Tradeshift, Tungsten, Generix...). - Missing currency when non-EUR —
CUX+2is mandatory if the currency differs from the one declared in the interchange agreement. A USD invoice with no CUX is ambiguous. - Invalid VAT code —
TAX[1]must be a known qualifier (7 = VAT, 5 = customs duty...). A custom undocumented code blocks straight-through processing. - Wrong UNT segment count — the value after
UNT+must include UNH and UNT themselves.
Related messages
INVOIC closes the order-to-cash cycle:
- ORDERS D.96A — the order, referenced via RFF+ON.
- ORDRSP D.96A — the order confirmation.
- DESADV D.96A — the despatch advice, referenced via RFF+DQ.
- RECADV D.96A — the buyer receipt advice.
- REMADV D.96A — the remittance advice that closes the cycle.
- CONTRL D.96A — the automatic syntactic acknowledgment.
JSON equivalent
JSON projection that matches the example above. This mapping is not normative — it's an ediverse convention to ease integration in TypeScript / Python environments.
{
"interchange": {
"controlRef": "CTRL000003",
"from": { "id": "5410000000456", "qualifier": "14" },
"to": { "id": "5410000000123", "qualifier": "14" },
"datetime": "2026-06-01T10:00:00Z",
"syntax": { "id": "UNOC", "version": "3" }
},
"message": {
"ref": "1",
"type": "INVOIC",
"version": { "syntax": "D", "release": "96A", "agency": "UN", "association": "EAN008" }
},
"invoice": {
"number": "INV-2026-1042",
"function": "380",
"status": "9",
"issueDate": "2026-06-01",
"deliveryDate": "2026-05-20",
"references": {
"buyerOrder": "ORDER789",
"despatchAdvice": "DESADV-2026-0521"
},
"parties": {
"supplier": { "gln": "5410000000456" },
"buyer": { "gln": "5410000000123" }
},
"currency": "EUR",
"paymentTerms": { "basis": "1", "days": 30, "discount": { "percent": 3, "days": 5 } },
"lines": [
{
"ref": 1,
"gtin": "3520000001234",
"quantity": { "invoiced": 2 },
"price": { "net": 849.00 },
"lineTotal": 1698.00,
"vat": { "rate": 20, "amount": 339.60 }
},
{
"ref": 2,
"gtin": "3520000005678",
"quantity": { "invoiced": 5 },
"price": { "net": 19.50 },
"lineTotal": 97.50,
"vat": { "rate": 20, "amount": 19.50 }
}
],
"totals": {
"totalLineNet": 1795.50,
"taxableBase": 1795.50,
"totalTax": 359.10,
"amountDue": 2154.60
}
}
}