Validate an EU VAT number in PHP
Validate an EU VAT number from PHP with one HTTPS request to an API that asks VIES for you: no SoapClient extension, JSON back.
Company check API: monthly plans and one-off packs, one API key.
PHP example
<?php
function check_vat(string $vat): ?array {
$ch = curl_init('https://agent-data-tools.revmesh2074.workers.dev/vat/validate?' . http_build_query(['vat' => $vat]));
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('API_KEY')],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($body === false || $status >= 500) return null; // no answer: try again later
if ($status !== 200) throw new RuntimeException($body);
return json_decode($body, true);
}
$result = check_vat('SE556703748501');
if ($result === null) echo "no answer right now\n";
elseif ($result['valid']) echo 'valid: ' . ($result['name'] ?? '') . "\n";
else echo "not valid\n";Set API_KEY to a key from /credits.
When an agent wants this
- Check a customer's VAT number in a WooCommerce, Laravel or plain PHP checkout
- Validate VAT numbers on hosting without the SOAP extension
- Skip the VIES SOAP service and its WSDL
VAT number validation, EU VIES $0.01
Check an EU VAT number against the European Commission's VIES service: valid or not, with the registered name and address where the member state shares them. Any spacing (SE556703748501, DE 123 456 789; EL or GR for Greece, XI for Northern Ireland). Or verify a business by name: found or not in the French, Swedish, Norwegian and Finnish registers. Use to check a B2B customer before invoicing without VAT, or to confirm a supplier.
Inputs: vat: VAT number with its 2-letter EU country prefix (give vat or name); name: Company name to verify instead of a VAT number: found or not in the FR, SE, NO and FI company registers; country: With name: search only this register (FR, SE, NO or FI, or the country's name).
Free first (3 successful calls per caller, no key):
curl "https://agent-data-tools.revmesh2074.workers.dev/vat/validate?vat=SE556703748501&trial=1"
With a card key from /credits, in a header or, when your client can only fetch a URL, in the URL:
curl -H "Authorization: Bearer adt_…" "https://agent-data-tools.revmesh2074.workers.dev/vat/validate?vat=SE556703748501"
curl "https://agent-data-tools.revmesh2074.workers.dev/vat/validate?vat=SE556703748501&api_key=adt_…"
Without a key the same URL answers 402 Payment Required with x402 and MPP terms, so a wallet client pays USDC per call and retries. Over MCP (https://agent-data-tools.revmesh2074.workers.dev/mcp) this tool is vat_validate.
Example result
{
"vat": "SE556703748501",
"country": "SE",
"number": "556703748501",
"valid": true,
"name": "Spotify AB",
"address": "REGERINGSGATAN 19, 111 53 STOCKHOLM",
"checkedAt": "2026-11-06T14:36:47.903Z",
"source": "EU VIES (European Commission)"
}Questions
Do I need the SOAP extension?
No. The API speaks to VIES; your code sends one HTTPS GET with cURL and reads JSON.
How should I treat an error?
As no answer, not as not valid. A 5xx means VIES or the member state could not be reached; the call is not charged and can be repeated.
How do I pay?
Each successful call costs the tool's price; failed calls are not charged. The first 3 calls are free. Then pay with card credits from $1 (the key goes in an Authorization header or as api_key= in the URL) or per call in USDC over x402 or MPP. No account is needed.