Guides › How to validate EU VAT numbers in an online store (Shopify, WooCommerce)
How to validate EU VAT numbers in an online store (Shopify, WooCommerce)
Updated
Short answer: To sell to an EU business without charging VAT, your store must confirm the buyer's VAT number is valid in VIES, ideally with a consultation number stored on the order. Validate at checkout, treat VIES errors as unknown rather than invalid, and keep the result with the order. If the number cannot be confirmed, charge VAT.
A store that sells to businesses in other EU countries can usually invoice without VAT, but only when the buyer is a business with a valid VAT number. Many stores collect the number in a text field and never check it. That works until a tax audit asks how you knew the customer was a taxable business.
What to do at checkout
- Collect the number with its country prefix. Use one field, and normalise it: remove spaces, dots and dashes, and convert
GRtoEL. See formats by country. - Check the format first. A wrong format never needs a VIES call. Show the expected format to the customer straight away.
- Ask VIES whether the number is active, and send your own VAT number as the requester so you get a consultation number.
- Remove VAT only on a clear "valid". Invalid means charge VAT. Unknown (country down, timeout) means either retry or charge VAT and refund later once confirmed.
- Store the result on the order: number, name and address returned, date and time, and the consultation number.
Handling VIES downtime without losing orders
VIES is a relay to national databases, and some countries go offline for hours. If your checkout calls it directly, a failed call must not read as "invalid". A practical approach: keep three states (valid, invalid, unknown), retry transient errors with backoff, and for unknown results let the order through at the VAT-inclusive price with a note to re-check later. The error code guide lists what each response means.
Shopify
Store the VAT number as a customer or company field, or in an order note attribute, and call a validation API from a checkout extension, a Flow automation or an app that runs on order creation. Keep the validation result in an order metafield so it appears next to the order for your accountant.
WooCommerce
Add a VAT number field at checkout, then validate it on the woocommerce_checkout_process hook and set the customer's tax exempt status only when the check returns valid. Store the result and consultation number as order meta.
Calling the VATcheckly API from your store
curl "https://vatcheckly.com/api/v1/check?vat=DE123456789&requester=FI12345678" \ -H "Authorization: Bearer YOUR_LICENSE_KEY"
The response has state (valid, invalid or unavailable), the company name and address, and the consultation number. Unavailable results are not counted against your quota. See the API docs for Node and Python examples.
Already have a backlog of customers?
Re-check your existing B2B customer list once a quarter. Numbers get deregistered, and an old "valid" is not evidence for a new invoice. Upload the list to the bulk checker and keep the CSV with the consultation numbers.
Sources: European Commission: VIES VAT number validation; EUR-Lex: Council Directive 2006/112/EC on the common system of VAT.
Check a VAT number now
Free, live against VIES, all 27 EU countries + Northern Ireland.