Download the PHP package byte8/module-vat-validator without Composer

On this page you can find all versions of the php package byte8/module-vat-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-vat-validator

Byte8_VatValidator — EU VIES + UK HMRC + Swiss UID VAT Number Validator

A lightweight Magento 2 module that validates B2B buyers' VAT numbers against the EU VIES REST API, the UK HMRC public lookup endpoint, and the Swiss UID-Register (Bundesamt für Statistik) — at customer registration and again at checkout — and automatically moves validated customers into a configurable "Zero Tax" customer group so the right tax rules fire immediately.

Why merchants install it

Features

Companion modules

Hyvä storefront support

Running a Hyvä-themed storefront? Install byte8/module-vat-validator-hyva for a live, debounced VAT-validation indicator on the registration and address forms — green / red badge appears under the VAT input as the customer types, no extra JS dependencies (Alpine + Tailwind only).

Requirements

Installation

Run the queue consumer

The checkout path is non-blocking: when the persisted result is stale or missing, the observer publishes to byte8.vat.revalidate instead of calling the upstream synchronously. You must run the consumer for those jobs to drain (otherwise the audit log won't refresh):

In production, supervise this under your existing consumer manager (e.g. bin/magento queue:consumers:list, systemd, or cron_run mode). The default Magento DB-backed queue is used — no AMQP / RabbitMQ broker is required, but you can switch the connection in etc/queue_topology.xml if you already run one.

Configuration

Navigate to Stores > Configuration > Byte8 > VAT Number Validator.

General

Field Description
Enable VAT Validator Master switch
Validate on Customer Save Run synchronous validation when a customer or address is saved (the customer is waiting on the form, so a synchronous call is appropriate)
Validate on Checkout Apply cached / async-revalidated VAT result during quote-address save (non-blocking)
Request Timeout (seconds) Hard response timeout on upstream calls. Default 2s
Connect Timeout (seconds) TCP/TLS connect timeout. Default 1s — fails fast on unreachable upstreams
Result Cache TTL (hours) How long a persisted validation outcome is reused before async revalidation is triggered. Default 24h
Requester Country Code Your 2-letter ISO code (e.g. GB, DE) — sent to VIES
Requester VAT Number Your own VAT number — included in VIES calls for a consultation number

EU VIES

Toggle + endpoint override. Defaults to the current EC REST endpoint.

UK HMRC

Field Description
Validate UK numbers via HMRC Toggle for the HMRC client
HMRC Lookup Endpoint v2.0 endpoint override; leave default unless HMRC publishes a new path
HMRC OAuth Token Endpoint OAuth 2.0 /oauth/token URL. Default https://api.service.hmrc.gov.uk/oauth/token
HMRC Client ID Required. OAuth client identifier from your HMRC application
HMRC Client Secret Required. OAuth client secret. Stored encrypted via Magento's Encrypted backend model

Each merchant must register their own HMRC application

The "Check a UK VAT number" API v2.0 is application-restricted and uses OAuth 2.0 client-credentials. Do not share credentials between sites or re-use a vendor's credentials — HMRC ties consultation references and rate limits to the calling application, so every audit-log entry must trace back to the merchant's own HMRC enrolment.

Setup steps for each merchant:

  1. Sign up at developer.service.hmrc.gov.uk.
  2. Create an application (production and sandbox if you want to test without hitting live data).
  3. Subscribe the application to "Check a UK VAT number" v2.0.
  4. Copy the application's Client ID and Client Secret into the admin fields above. The module uses them to fetch a short-lived bearer token via OAuth client_credentials; tokens are cached in Magento's default cache for ~expires_in − 60s so checkout requests never wait on the token endpoint.

Customer Group Mapping

Field Applied When
Auto-Assign Customer Group Master switch for group assignment
Domestic Group VAT valid AND buyer country == requester country
Intra-EU / UK Valid Group VAT valid AND buyer country != requester country (zero-tax / reverse-charge)
Invalid Group VAT validation returned "invalid"

When VIES or HMRC is unavailable (HTTP 5xx, timeout, malformed response) the customer's current group is preserved — we never downgrade a customer based on a flaky upstream.

Validation Log (DACH compliance: §18 / §147 AO)

Field Description
Persist Validations to DB Master switch — when Yes, every valid / invalid outcome is written to byte8_vat_validator_log. Transient unavailable errors are NOT persisted, keeping the audit log clean.
Retention (years) Default 10 — matches §147 AO. A nightly cron (byte8_vat_validator_prune_log at 03:17) deletes anything older.

View entries under Stores → Byte8 → VAT Validation Log. The grid supports filters (date range, country, status, source, customer email, qualified-confirmation reference) and CSV / Excel XML export — the export button is gated by a separate Byte8_VatValidator::log_export ACL so you can grant view access without granting export.

Each row stores: customer id + email at time of check, store id, country, VAT number, status, source (vies / hmrc), the upstream requestIdentifier (your qualifizierte Bestätigung reference), the returned company name + address, and the raw request + response payloads for audit reconstruction.

REST endpoints

Two routes, with different latency/freshness trade-offs:

Returns a JSON validation result:

Status is one of valid, invalid, unavailable, skipped.

CLI

Validate one number

Exit code 0 on valid, 1 otherwise — handy in CI / smoke tests.

Bulk re-validate every B2B customer

Useful right after install (back-fill validations for an existing customer base) or as a periodic clean-up to catch numbers that became invalid.

Each result is persisted to byte8_vat_validator_log automatically (no special-case path — same event hook the live observers use). The command prints a per-row outcome and a final summary with valid / invalid / unavailable / skipped counts.

How the "Zero Tax" rule gets applied

This module does not edit tax rules directly. Instead:

  1. Configure a customer group (e.g. "B2B EU Valid") with the tax class you want.
  2. Add a Magento tax rule that maps that tax class to 0%.
  3. Point the module's Intra-EU / UK Valid Group setting at the group above.

When validation succeeds during registration, the customer is moved into that group — and when it succeeds during checkout, the quote's customer group is updated in-flight so totals recalculate before the order is placed.

Logging

All validator activity is logged to var/log/vat_validator.log. In production, tail this file to monitor upstream availability and validation outcomes.

Upsell hook

After install, merchants receive a follow-up email from Byte8 introducing Byte8 Ledger, which syncs validated B2B customers straight into Sage and Xero. Cross-sell copy lives in Byte8's email platform, not in this module.

Privacy & GDPR

This module processes and stores personal / business data — read this section before installing on a production store.

What we send to third parties

Upstream Data sent Where it goes
EU VIES The buyer's country code, VAT number, and (if configured) your own country + VAT number as the requester EC Directorate-General for Taxation and Customs Union (ec.europa.eu)
UK HMRC The buyer's VAT number, and (if your requester VAT is configured) your own VAT number HM Revenue & Customs (api.service.hmrc.gov.uk)
Swiss UID-Register The buyer's UID (CHE prefix + 9 digits) Bundesamt für Statistik (uid-wse.admin.ch)

Both upstreams may return the buyer's company name and registered business address. We persist these in byte8_vat_validator_log only when the "Persist Validations to DB" setting is enabled.

Lawful basis (GDPR Art. 6 / UK GDPR Art. 6)

This means you do not need consent to use this module for B2B validation — it falls under your existing tax-compliance obligations. You do need to disclose the processing in your privacy policy. Suggested copy:

We verify your VAT identification number against the European Commission's VIES database (and, for UK numbers, against HMRC) when you register or place an order, in order to apply the correct VAT treatment. The validation result, including any company name and address returned by VIES / HMRC, is retained for [10] years in line with our statutory tax-record obligations.

Data subject rights

The validation log is keyed on customer_id (with ON DELETE SET NULL), so deleting a customer detaches their log entries but preserves the historical record for audit. If a data subject requests erasure under GDPR Art. 17, you'll need to weigh that against your Art. 17(3)(b) exemption for "compliance with a legal obligation". In most cases the tax-record obligation prevails — document this in your erasure-request response process.

What we do NOT do

License

MIT — see LICENSE.txt.


All versions of module-vat-validator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3|^8.4|^8.5
magento/framework Version ^103.0
byte8/module-core Version *
byte8/module-activation Version ^1
magento/module-customer Version ^103.0
magento/module-quote Version ^101.0
magento/module-tax Version ^100.0
magento/module-backend Version ^102.0
magento/module-config Version ^101.0
magento/module-webapi Version ^100.0
magento/module-cron Version ^100.0
magento/module-ui Version ^101.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package byte8/module-vat-validator contains the following files

Loading the files please wait ...