Invoice Automation with XML: Goods Receipt and Payables
Invoice automation with XML explained: read structured invoice files, post goods receipts and payables automatically, and match each one to its purchase order.
By Downway Team 3 min read
Invoice automation with XML means reading the structured file a supplier sends, extracting its data, and posting the goods receipt and the payable without keying anything in. Because the file is already structured, reading it is reliable. The part that needs care is matching against the purchase order, which should stay in place. The examples here use the Brazilian NF-e format, but the same logic applies to e-invoicing formats elsewhere.
What the XML file gives you
A typical e-invoice file holds the issuer's tax ID, line items with code, description, tax classification, quantity and unit price, taxes, carrier data and payment installments. The Brazilian NF-e also carries a unique 44-digit access key.
A unique document key like that is what lets you block duplicate postings and, where applicable, check the document's status with the tax authority.
How the flow works
- Capture. Files arrive through a dedicated mailbox, a tax portal download or a document-exchange service. The automation collects them into a folder or queue.
- Read and validate. The program extracts the fields, confirms the buyer is your company and checks whether the key was already processed.
- Match to the order. Each invoice line is compared with the purchase order by supplier item code, quantity and price.
- Decide. If everything is inside the tolerance you set, the invoice proceeds. If not, it goes to an exceptions queue with the reason.
- Post. The system records the stock receipt and taxes and creates payables with the due dates from the file.
- Archive. The original XML is stored with its key in the file name, since tax law requires keeping the document for a set period.
Order matching: the control you should not skip
Reading the XML is the easy part. The real value is comparing the invoice with what was ordered. Set clear tolerances, such as a price difference up to 1% or a quantity up to the open balance on the order, and route everything else to a person.
Invoices with no purchase order, such as services and expenses, can follow another rule, for example requiring the budget owner's approval before posting.
Practical pitfalls
- supplier item codes differ from yours, so build and maintain a cross-reference table;
- invoices covering several orders or partial deliveries need balance handling;
- returns, adjustments and cancellations need their own rules;
- XML layouts have versions and optional fields, so the reader should fail with a clear warning, not a silent error;
- confirm tax, credit and bookkeeping rules with your accountant before automating.
What to expect
The gains show up as fewer hours of data entry, fewer tax and stock errors, and payables ready as soon as goods arrive. To tie this into your ERP, a conversation about custom automation starts by mapping how your invoices arrive today and which exceptions happen most often.
Frequently asked questions
Can invoices be posted automatically without an ERP?
Yes, the XML can feed a spreadsheet or a simple finance system, but stock control and purchase order matching will be more limited.
Can the automation read PDF invoices too?
It can, with a higher risk of errors. XML is preferable because it is structured and carries the document key. Always ask the supplier for the XML.
What if the invoice does not match the order?
Send it to an exceptions queue with the reason for the difference. The buyer decides to accept, request a correction or return, and payment is released only afterwards.