Como validar o NIF no checkout + VIES para B2B europeu?
Categories:
Magento Developer Portugal
Two Portuguese fiscal identifiers, two different validators:
- NIF (Número de Identificação Fiscal), 9-digit Portuguese tax-ID. Format follows strict rules: first digit indicates entity type (1-3 individuals, 5 companies, 6 public, 9 other). Last digit is a check-digit. Required on every Portuguese invoice, without it, the AT (Autoridade Tributária) rejects the SAFT-PT e-Fatura submission.
- VIES VAT, format
PT + 9-digit NIF. EU-wide validation via the VIES service for cross-border zero-rated B2B sales.
For Magento PT we:
- Add NIF field to the
customerentity +quote_address+sales_order_address. - Validate NIF check-digit client-side at checkout (instant, no API call), rejects mistyped NIFs immediately.
- Validate against the AT’s public lookup endpoint for company NIFs, auto-fills company name + registered address.
- Validate VIES on B2B intra-EU customers, required for 0% reverse-charge IVA.
- Apply 0% IVA on B2B intra-EU sales with valid VIES-validated NIF; 23% on B2C and PT→PT B2B.
- Cache validations 30 days, re-validate on any address change.
Was this helpful?