DEV Community

challan116-ux
challan116-ux

Posted on

The EDIFACT INVOIC, Decoded: An Invoice Is a Claim That Three Earlier Messages Have to Support

Short answer: INVOIC is UN/EDIFACT's invoice message — the global counterpart to the X12 810 · Invoice. A seller sends INVOIC to bill for goods or services already ordered and, usually, already despatched. If ORDERS is the promise and DESADV is the shipment, INVOIC is the bill — and it only gets paid cleanly when it agrees, line by line, with both of them.

I build EDI tooling for a living. Here is how INVOIC actually works, segment by segment.

What does an INVOIC message actually contain?

An INVOIC sits inside an EDIFACT interchange (UNB/UNZ envelope), and its own structure runs like this:

  • UNH — opens the message and names it: message type INVOIC, plus the directory version and release (for example D:96A or D:01B). The directory decides which segments and codes are even legal.
  • BGM — the document header: what kind of invoice this is (a commercial invoice, a credit note, a debit note) and the seller's invoice number. That number is what the buyer pays against — lose it and nothing downstream matches.
  • DTM — the dates that drive payment terms: invoice date, and where relevant the delivery or tax point date. A wrong tax-point date can put a correct invoice in the wrong VAT period.
  • RFF — references that tie the invoice back to the chain: the buyer's order number from ORDERS, the despatch advice number from DESADV, a contract reference. These are the join keys for the three-way match.
  • NAD — the parties: seller, buyer, invoicee, payer. Each NAD carries a qualifier naming its role; the same company often appears in several roles at once.
  • LIN / PIA / IMD — the billed lines themselves: line number, the buyer's item number and additional IDs such as a GTIN in PIA, and the description. LIN numbers the line; everything about that charge hangs off it.
  • QTY / PRI / MOA — the invoiced quantity, the unit price, and the line amount. INVOIC states what the seller believes is owed; whether it matches the agreed price is the buyer's check to run.
  • TAX — the tax treatment per line or summary: rate, category, and amount. In EDIFACT markets this is rarely decoration — a missing or wrong TAX segment is a compliance rejection, not a rounding note.
  • UNS / MOA / CNT / UNT — the summary and trailer: total invoiced amount, tax totals, control counts, and the segment count that proves the message arrived whole.

How is INVOIC different from the X12 810?

The business content is nearly identical — parties, lines, quantities, prices, taxes, totals. The differences that break integrations are structural:

The credit note lives in the same message. X12 splits billing across the 810 · Invoice and the 812 · Credit/Debit Adjustment. INVOIC carries its document type in BGM — the same message type can be an invoice, a credit note, or a debit note. Code that assumes every INVOIC increases what is owed will eventually post a credit as a charge.

Tax is a first-class citizen. X12 invoices often carry tax as a summary afterthought. INVOIC was built for VAT regimes: TAX segments, tax-point dates, and per-rate summaries are part of the message's normal shape, and many partners validate them before they look at a single line price.

The acknowledgment pair is different. X12 answers an 810 at the syntax layer with a 997 · Functional Acknowledgment. EDIFACT answers INVOIC with CONTRL for syntax where the agreement calls for it — and a disputed INVOIC is answered commercially, with a credit note or a corrected invoice, not with a status message that quietly makes the problem go away.

Versions are directories, not releases of one guide. X12 partners argue about 4010 versus 5010. EDIFACT partners argue about D.96A versus D.01B, and a segment valid in one directory may not exist in the other. The version negotiation happens before mapping, or it happens as a rejection.

What breaks most often in production?

Billing against the order instead of the shipment. INVOIC should bill what DESADV says actually left the building. Shops that generate the invoice from ORDERS bill for the backordered line too — and discover it at payment, the most expensive place to discover anything.

Losing the buyer's references. The order number, the despatch number, and the line numbers are how the buyer's system matches invoice to order to receipt. An INVOIC that carries only the seller's internal references forces a human to do the matching, at human speed and human error rates.

Treating a credit note as a negative invoice. A credit note references the original invoice and reverses specific lines for specific reasons. Posting it as a free-standing negative total destroys the audit trail that both finance teams will need at quarter-end.

Rounding tax per line when the partner rounds per rate. Both totals are defensible; they differ by cents; and the invoice fails the match. Tax rounding is a partner agreement, not an implementation detail — settle it in the subset guide, not in production.

What should you do with an INVOIC message?

  1. Read the document type first. BGM tells you whether this is a charge, a credit, or a debit before a single amount is posted.
  2. Run the three-way match. Invoice lines against ORDERS lines against DESADV quantities — in that order, per line, before payment is scheduled.
  3. Validate against the partner's subset, not the directory alone. Almost nobody trades raw D.01B; they trade a documented subset of it. The subset is the contract.
  4. Answer disputes commercially and explicitly. A wrong INVOIC gets a corrected INVOIC or a credit note that references it — never silence, and never a quietly edited resend with the same number.

FAQ

Is INVOIC the same as an 810?
In business purpose, yes: both are invoices. In syntax, tax handling, credit-note handling, and versioning, no — plan a real mapping between them, not a rename.

What answers an INVOIC message?
CONTRL for syntax-level acknowledgment where the agreement calls for it. Commercially, payment — or a credit note / corrected invoice when the bill is disputed.

Can one INVOIC bill against more than one order?
It can, when the partner agreement allows consolidated billing — but every line still needs its RFF trail back to its own order and despatch, or the three-way match collapses.

What directory version should a new INVOIC integration use?
The one your partner's implementation guide specifies. D.96A and D.01B are both still common in production; supporting "EDIFACT" without naming a directory is supporting neither.


Getting INVOIC matched cleanly against the order and the shipment — and handling the credit note when it does not match — is a large part of what we built SignalEDI to handle. I'm Chris, founder of SignalEDI — if your EDIFACT invoices keep failing on tax or reference mismatches nobody can explain, I'd genuinely like to hear where yours break.

Top comments (2)

Collapse
 
hiredov profile image
Dov at HireDov •

The point that a credit note lives inside the same INVOIC message, distinguished only by BGM, is the one I'd tattoo on every integration spec. We've seen how easily a parser written for "invoice increases amount owed" can post a credit as a charge. In your tooling, do you validate the BGM document type before the three-way match runs, or do you let the match fail and sort it out afterwards? I'm also curious how you handle partial despatches: when one ORDERS has two DESADVs and a single INVOIC referencing only one of them via RFF, do you match at the line level across both, or reject the invoice until the references line up?

Collapse
 
hiredov profile image
Dov at HireDov •

The three-way match framing is the useful bit. One thing I'd add: store the price the buyer agreed to (from the quote/ORDERS) alongside the INVOIC line, with a tolerance and a reason code, so a mismatch reads as "price +3%, within tolerance" and not just "rejected". Credit notes sharing the INVOIC type via BGM is exactly the kind of thing that bites later; a test fixture with a credit note and a partial despatch catches most of it early. Do you see more disputes come from price differences or from quantity gaps against DESADV?