VAT/tax ID misread during invoice extraction
Recovers misread VAT and tax IDs on invoices using format validation and registry checks. Use when the extracted tax ID fails format checks. Not for tax calculation or tax code selection.
TL;DR
Tax IDs are long alphanumeric strings where a single misread character breaks validation, and they are critical for EU VAT compliance. Validate the extracted ID against the country's format pattern, apply OCR confusion swaps for common pairs, and verify against the VIES registry for EU VAT numbers. Never post an invoice with an unvalidated tax ID when reverse-charge or VAT reclaim is involved.
Error
Extracted VAT ID: DE813456789 (checksum invalid; expected DE followed by 9 digits)Steps
Validate the extracted ID against the country's tax ID pattern. Expected: A clear pass/fail on format.
Apply confusion swaps (0/O, 1/I, 5/S, 8/B) and re-validate. Expected: A corrected ID that passes the pattern.
For EU VAT numbers, query the VIES registry for the corrected ID. Expected: Authoritative confirmation the ID exists.
Compare against the vendor master tax ID on file. Expected: Agreement, or a vendor-record update task.
On persistent failure, flag for review; do not guess. Expected: Compliance risk stays with a human decision.
When to use
- Extracted tax ID fails format or checksum validation
- EU invoices where VAT reclaim is claimed
- New vendor onboarding from an invoice
When not to use
- Choosing tax codes for lines
- Computing tax amounts
- US sales tax nexus questions
Compatibility
VIES SOAP/REST for EU VAT; country patterns encoded locally. Extractor-agnostic.
Variant phrasings
VAT number OCR wrong
tax ID validation failed invoice
VIES check failed
Root cause
Tax IDs mix letters and digits in long strings with no redundancy except a checksum. OCR errors that are harmless in prose become fatal here, and registries reject the whole ID on one wrong character.
Edge cases
- Some countries have multiple valid formats; check all of them
- VIES can be down; cache recent validations and retry with backoff
- UK VAT IDs post-Brexit validate differently from EU ones
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_OxBc6uCbcsxU3dZ6GjcCIQ