View Categories

VIES IP Blocking and Alternative VAT Validation Solutions

Overview of the VIES IP Blocking Issue #

The official VAT Information Exchange System (VIES), managed by the European Commission, is the primary service for validating VAT identification numbers within the European Union. Recently, some users reported this in their log file IP_BLOCKED. When a server’s IP is blocked, the plugin is unable to communicate with the official validation service, resulting in failed or unknown validation responses.

IP Blocked

While the exact criteria for these blocks remain undisclosed by the European Commission, they often affect shared hosting environments or servers with high request volumes. While migrating to a different hosting provider or obtaining a new server IP address may resolve the issue, such measures are often impractical for many businesses.

To ensure uninterrupted VAT validation when your server IP is blocked by VIES, we recommend utilizing a reliable third-party service. Vatlayer is a highly recommended alternative that provides a robust API for VAT number validation.

Benefits of Using Vatlayer #

• High Reliability: Operates independently of your server’s IP reputation with VIES.

• Free Tier Available: Offers a free plan that includes up to 100 VAT checks per month, suitable for many small to medium-sized businesses.

• Comprehensive Data: Provides company names and addresses in addition to validity status.

To begin, you will need to register for an API key at vatlayer.com/pricing.

Implementation Guide: Integrating Vatlayer via PHP Snippet #

If you have identified that your server IP is blocked, you can redirect the plugin’s validation requests to Vatlayer by implementing a custom PHP code snippet.

Step 1: Install a Snippet Manager #

We recommend using a plugin such as Code Snippets to safely add custom PHP code to your WordPress site without modifying your theme’s functions.php file.

Step 2: Add the Custom Snippet #

Create a new snippet and paste the following code.

Important: You must replace the placeholder API key (YOUR_KEY_HERE) with the personal API key obtained from your Vatlayer account.

/**
 * alg_wc_eu_vat_validation_response.
 *
 * @author  WPFactory <su*****@*******ry.com>
 * @see     https://wordpress.org/plugins/eu-vat-for-woocommerce/
 */
add_filter(
	'alg_wc_eu_vat_validation_response',
	function ( $response, $method, $country_code, $vat_number ) {

		$key = '3455dc81cbb4660ae86eff95acefed58'; // TODO: set your key here

		$url = "https://apilayer.net/api/validate?access_key={$key}&vat_number={$country_code}{$vat_number}";

		$curl = curl_init( $url );
		curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
		curl_setopt( $curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
		curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 0 );
		curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, 0 );
		$res = curl_exec( $curl );
		curl_close( $curl );

		if ( $res ) {
			$res = json_decode( $res, true );
			$response = json_encode(
				array(
					'isValid'   => $res['valid'],
					'name'      => $res['company_name'],
					'address'   => $res['company_address'],
					'vatNumber' => $res['vat_number'],
				),
			);
		}

		return $response;
	},
	10,
	4
);

Step 3: Verify the Configuration #

Once the snippet is active and your API key is correctly inserted, perform a test VAT validation on your checkout page or via the plugin settings to ensure that the validation is now processing correctly through the Vatlayer API.

Summary of Service Comparison #

FeatureOfficial VIES ServiceVatlayer API
CostFreeFree (up to 100 checks/mo) / Paid Tiers
ReliabilityHigh High (API-based)
SetupDefault (No setup required)Requires API Key & Code Snippet
Official Sourceec.europa.euvatlayer.com

References #

1.VIES VAT Number Validation Official Service

2.Vatlayer API Pricing and Registration

3.EU VAT for WooCommerce Plugin Page