Chat on WhatsApp

Como validar o NIF no checkout + VIES para B2B europeu?

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:

  1. Add NIF field to the customer entity + quote_address + sales_order_address.
  2. Validate NIF check-digit client-side at checkout (instant, no API call), rejects mistyped NIFs immediately.
  3. Validate against the AT’s public lookup endpoint for company NIFs, auto-fills company name + registered address.
  4. Validate VIES on B2B intra-EU customers, required for 0% reverse-charge IVA.
  5. Apply 0% IVA on B2B intra-EU sales with valid VIES-validated NIF; 23% on B2C and PT→PT B2B.
  6. Cache validations 30 days, re-validate on any address change.
Was this helpful?