Home / Use cases / E-commerce

E-commerce

EU VAT Validation for E-commerce

E-commerce stores selling B2B across EU borders must verify customer VAT numbers before applying zero-rate treatment. Use the TaxID API at checkout to validate EU VAT numbers in real time and prevent costly misapplied tax exemptions.

Cross-border B2B e-commerce in the EU is subject to the intra-community supply rules: when selling goods or services to a VAT-registered business in another EU country, you can apply zero-rate (VAT-exempt) treatment — but only if you can prove the buyer's VAT number is valid and active at the time of sale.

Many e-commerce platforms (Shopify, WooCommerce, Magento, PrestaShop) allow customers to enter a VAT number at checkout, but they do not verify it against any official registry. A customer can enter a plausible-looking number — or even a valid number belonging to another company — and the platform will zero-rate the order without complaint. The TaxID API checks the number against the live VIES registry in real time and returns the company name and address registered with the member state's tax authority.

Build a server-side validation step into your checkout flow: after the customer submits their VAT number, call the TaxID API before confirming the order. If the number is 'active', apply zero-rate and store the validated company details in the order record. If it is 'invalid', show an error. If VIES is temporarily unavailable ('service_unavailable'), charge standard VAT and issue a credit note once the system recovers.

For marketplaces and stores processing high order volumes, use the batch endpoint (POST /api/v1/validate) to validate up to 25 numbers per request. Combined with the 24-hour cache on valid numbers, this keeps API costs predictable even during peak checkout periods.

Implementation steps

  1. 1

    Get a free TaxID API key

    Sign up at taxid.dev/signup and store your API key as a server-side environment variable. Never expose it in client-side JavaScript or checkout scripts.

  2. 2

    Add a VAT number field to your checkout

    Add a clearly labeled VAT number input to your B2B checkout form. For WooCommerce, use a checkout hook. For Shopify, use a custom storefront field or checkout extension. For custom stores, add the field to your billing section.

  3. 3

    Validate via the TaxID API before confirming the order

    On form submission, call GET /api/v1/validate/:country/:vat from your server. Parse the two-character country prefix from the VAT number (e.g., 'DE' from 'DE123456789'). Check that status === 'active' before applying zero-rate. Return a form error for 'invalid'; charge standard VAT for 'service_unavailable'.

  4. 4

    Store the validated company details on the order

    Persist the company_name and company_address from the TaxID response alongside the VAT number and validation timestamp in your order database. This audit record is required under EU invoice rules if you are audited.

Code example

Node.js

const res = await fetch(
  'http://localhost:3000/api/v1/validate/DE/DE123456789',
  { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const { valid, status, company_name, company_address } = await res.json();

if (valid) {
  console.log(`Valid EU business: ${company_name}`);
} else if (status === 'service_unavailable') {
  // VIES is temporarily down — retry or allow with manual check
  console.log('VIES unavailable — check back in a few minutes');
} else {
  console.log('Invalid VAT number — charge local tax rate');
}

Python

import requests

res = requests.get(
    "http://localhost:3000/api/v1/validate/DE/DE123456789",
    headers={"Authorization": "Bearer YOUR_API_KEY"}
)
data = res.json()

if data["valid"]:
    print(f"Valid: {data['company_name']}")
elif data["status"] == "service_unavailable":
    print("VIES temporarily unavailable")
else:
    print("Invalid VAT number")

API response

The TaxID API returns a consistent JSON response for every validation request:

200 OK (active)valid
{
  "valid": true,
  "status": "active",
  "country_code": "DE",
  "vat_number": "123456789",
  "company_name": "Example GmbH",
  "company_address": "Musterstraße 1, 10115 Berlin",
  "request_date": "2026-05-10T00:00:00.000Z",
  "cached": false,
  "request_id": "req_01j..."
}

Error handling

The API uses a consistent Stripe-style error format. Always handle service_unavailable separately — VIES has occasional downtime and you should not reject valid customers during outages.

active

VAT number is valid and the business is registered

invalid

VAT number format is wrong or not registered in VIES

service_unavailable

VIES or the national system is temporarily down — retry later

Frequently asked questions

Does my e-commerce platform validate EU VAT numbers automatically?

No. Shopify, WooCommerce, Magento, and most e-commerce platforms collect VAT numbers as text fields but do not verify them against VIES or any official registry. You need to integrate a validation API — such as TaxID — to check that the number is real and currently active.

What is the difference between format validation and live VIES validation?

Format validation checks that the VAT number matches the expected pattern for the country (e.g., DE123456789 for Germany). Live VIES validation checks the number against the EU Commission's registry and confirms it is currently registered to an active business. Only live validation satisfies the EU's verification requirement for zero-rating B2B supplies.

Which countries can I validate for my e-commerce store?

The TaxID API validates all 27 EU member states via VIES, plus UK (HMRC), Norway (Brønnøysund Register), and Australia (ABN Lookup). For EU exports, all 27 member states are eligible for zero-rate treatment under intra-community supply rules.

Further reading

Evaluating EU VAT APIs? Compare TaxID with:

Ready to implement?

Get your free API key and start validating EU VAT numbers today.

Get free API key

Related use cases

Stripe EU VAT: Validate Tax IDs Before Charging Customers

Stripe EU VAT integration guide: validate EU VAT numbers server-side before applying zero-rate B2B e...

UK VAT validation in Shopify B2B

Validate UK VAT numbers for B2B customers in Shopify. Required under UK Making Tax Digital rules for...

WooCommerce Spain NIF/CIF validation

Validate Spanish NIF and CIF numbers in WooCommerce checkout. Automatically apply B2B tax exemptions...