Key features and benefits of the module
🌍 EU VAT validation — provider chain
- VIES REST API (European Commission) — official EU service, free of charge, no API keys required, returns a consultation number compliant with regulations
- VATcomply — free proxy to VIES, limit of 2 requests/s/IP, no authentication
- VATLayer (APILayer) — commercial API with high availability, requires an API key, returns full company data
- viesapi.eu — Polish commercial VIES proxy with HTTP Basic Auth, fast response times
- Configurable 3-slot chain — choose Provider 1 (primary), Provider 2 (backup), Provider 3 (last resort)
- Automatic fallback — if the first provider returns an error or timeout, the module automatically tries the next one
- Per-provider timeout and retry — configure separate time limits for each provider
- Per-provider cache TTL — different cache validity periods for each API
- Duplicate protection — JavaScript blocks selecting the same provider in 2 slots, server-side validation in PHP
🇵🇱 Polish NIP validation — GUS register
- Integration with GUS BIR1.1 API — official government REGON register, free key from api.stat.gov.pl
- Simple NIP checksum verification — weighted algorithm according to the official Ministry of Finance specification
- Rejection of invalid patterns — all zeros, all ones, identical digits — blocked automatically
- Checksum validation = 10 — according to the official NIP specification, the value 10 is invalid
- Company data retrieval — name, address, postal code, city from the REGON register
- Configurable timeout and retry — adjustment to the performance of GUS servers
💰 Automatic VAT exemption (0% reverse charge)
- Automatic application of 0% VAT for verified B2B customers from EU countries
- Configurable source country — exclusion of 0% for domestic transactions (compliant with VAT law)
- List of countries for VIES verification — choose specific countries covered by validation
- "Allow if validation fails" option — do not block registration in case of VIES failure
- Integration with the PrestaShop tax engine via `TaxManagerInterface`
👥 Automatic customer group management
- Auto-assignment of group after validation — e.g. automatically add to the "B2B" or "VAT Exempt" group
- Preservation of existing groups — the customer does not lose any of their current groups
- Idempotent adding — no duplicates even with repeated validation
- Group::isLoadedObject validation — safety with deleted groups
📧 Email notifications
- Email to admin on new B2B validation — immediate information about a new business customer
- Email on re-validation failure — security alert when VAT is no longer valid
- Multilingual templates (Polish, English) — editable in the standard PS editor
- Configurable sender address — by default the store email from PS settings
🔄 Re-validation on order status change
- Automatic VAT re-check when the order changes to the selected status (e.g. "Payment accepted")
- Compliance protection — catches situations where VAT expired between the order and shipment
- Full audit log — every re-validation is saved with the VIES consultation number
- Multishop-aware — uses the shop context from the order, not the current admin selector
📊 Professional administrator dashboard
- 5 dashboard sections — provider chain, validation statistics, recent validations, provider telemetry, quick start guide
- Chain visualisation — 3 slots with icons, names, status (active/disabled/no key)
- 7 KPI cards — total, valid, invalid, last 7 days, VIES, GUS, cache entries
- Table of the last 10 validations — VAT number, source, result, company, customer, date
- Provider telemetry — per-provider success rate, number of checks, last call
- Provider cards with FREE/PAID badges — clear information about costs
- Automatic colour coding — green (OK), orange (warn), red (error)
🏪 Full multistore support
- Per-shop cache isolation — `id_shop` column in the cache table, composite UNIQUE key
- Per-shop log isolation — audit per legal entity
- Per-shop configuration — different providers, API keys, customer groups for each shop
- Shop-aware re-validation — hook uses the order context, not the admin context
- Automatic default settings for all shops during installation
⚡ Performance and optimisation
- Two-level cache — static (in-memory) + persistent (database)
- Negative cache — no repeated DB queries for unvalidated numbers
- TTL enforcement on read — old entries are automatically ignored
- Lazy dashboard rendering — statistics calculated only on the Dashboard tab
- Single aggregated SQL query — 6 COUNT(*) → 1 SUM(CASE WHEN)
- Read replica for all reads (`_PS_USE_SQL_SLAVE_`)
- Dedicated indexes — idx_date, idx_source, idx_shop
- Log retention via CRON — automatic cleanup after a configurable period (default 365 days)
🔒 Security
- CSRF tokens in all entry points (front, admin, CRON)
- Timing-safe comparison (`hash_equals`) for token validation
- Full SQL sanitisation — `pSQL()`, `(int)`, `bqSQL()` everywhere
- Smarty escaping — `htmlall:UTF-8` for all variables in templates
- SSL verification — `CURLOPT_SSL_VERIFYPEER=true` in all provider calls
- Provider whitelist — it is impossible to save an invalid provider in the chain
- _PS_VERSION_ guard in every PHP file
- AdminSecurity annotation in the Symfony admin controller
🛠️ Compatibility and dependencies
- PrestaShop 1.7.0 – 9.x — full compatibility, versioned guards
- PHP 7.0 – 8.5 — no modern syntax without guards
- MySQL 5.6+ / MariaDB 10.x+ — utf8mb4 charset
- Zero Composer / vendor — custom PSR-4 autoloader (15 lines of code)
- Dual translation system — trans() + l() fallback works on all PS versions
- Complete Polish translations — 200+ entries in pl.php and XLF files
- Dual theme support — legacy (Smarty) and modern (Symfony) admin themes
👨💼 Administration panel — 10 tabs
- Dashboard — dashboard with 5 sections, default tab
- Settings — general validation options, ISO check, auto-group, cache TTL, re-validation
- EU VAT Settings — enable VIES, country list, 0% rate, allow on fail, source country
- Provider chain — 3 selects with JavaScript blocking duplicates
- VIES REST — timeout, cache TTL, retry (no keys)
- VATcomply — timeout, cache TTL, retry (no keys)
- VATLayer — API key, timeout, cache TTL, retry
- viesapi.eu — identifier, access key, timeout, cache TTL, retry
- GUS Configuration — enable, country, user key, allow on fail, timeout, cache TTL, retry
- Tools — CRON URL for cleaning cache and logs
🎯 Who is this module for?
- PrestaShop stores selling to businesses (B2B) in the European Union
- Sellers issuing reverse charge invoices
- Stores serving the Polish market requiring NIP verification in GUS
- Multistore platforms with different legal entities per shop
- Sellers needing a VAT validation audit compliant with tax regulations
- Stores with a high volume of B2B transactions requiring cache and high availability