Quittio next API

ViesVerifier
in package
implements VatIdVerifier

FinalYes

VAT identifier check via the REST interface of the EU VIES service.

Only identifiers of the EU member states (Greece: "EL") and of Northern Ireland ("XI") are sent to VIES; others are reported as not supported. Only the answers VALID and INVALID count as a result and are cached. Errors (INVALID_INPUT, MS_UNAVAILABLE, TIMEOUT, …) and unreachable services give $valid = null, are not cached and never block validation.

Table of Contents

Interfaces

VatIdVerifier
Online check of VAT identifiers (e.g. EU VIES). Implementations must never throw because a service is unavailable; they return a result with $valid = null instead.

Constants

ENDPOINT  : string = 'https://ec.europa.eu/taxation_customs/vies/res...
PREFIXES  : array<string|int, mixed> = ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE'...

Methods

__construct()  : mixed
supports()  : bool
Whether VIES can check the VAT identifier (EU member state prefix incl. "EL", or "XI").
verify()  : VatIdVerification

Constants

ENDPOINT

public string ENDPOINT = 'https://ec.europa.eu/taxation_customs/vies/rest-api/ms/%s/vat/%s'

PREFIXES

public array<string|int, mixed> PREFIXES = ['AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'EL', 'ES', 'FI', 'FR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'XI']

VAT identifier prefixes VIES can check

Methods

__construct()

public __construct([int $timeout = 5 ][, int $cacheTtl = 86400 ][, callable(string, int): Array|null $http = null ]) : mixed
Parameters
$timeout : int = 5
$cacheTtl : int = 86400
$http : callable(string, int): Array|null = null

returns the response body or null on failure

supports()

Whether VIES can check the VAT identifier (EU member state prefix incl. "EL", or "XI").

public static supports(string $vatId) : bool
Parameters
$vatId : string
Return values
bool
On this page

Search results