Update: Now Open eShop is MOSS ready 😉 AND here you can have a FREE API to verify rates and VAT numbers.
So all the sudden the 1st of October we got the news of a new rule for VAT on EU. There was almost not any media coverage and thousands of small business are going to lose a lot since will be lot more difficult to sell your digital goods and adapt to this changes.
With this new rule business operating on EU need to charge the VAT of the customer country of residence and not the one from the business country.
This is called MOSS (Mini One Stop Shop). Here UK gov did a good guide explaining all more in deep and pretty clear, good job. More info from Rachel Andrew.
For those like me that need to adapt some software carts to comply with this law you, I have done a list of resource I will use.
Some PHP scripts or plugins that do the job:
Woocommerce
https://wordpress.org/plugins/woocommerce-eu-vat-compliance/
https://wordpress.org/plugins/eu-vat-redirect/
Whmcs
http://www.whmcs.com/appstore/219/EU-VAT-Invoicing-Addon.html
VIES PHP validation
http://stackoverflow.com/questions/9158119/vies-vat-number-validation
http://www.webmastersdiary.com/blog/php-vies-vat-number-validation-european-vat-id/
https://github.com/herdani/vat-validation
Country codes
https://gist.github.com/vxnick/380904
To validate the VAT number
https://github.com/herdani/vat-validation
To get a list of updated VAT by country
https://wceuvatcompliance.s3.amazonaws.com/rates.json
https://euvatrates.com/rates.json
Get the country of the visitor
//if you use cloudflare really easy:
if (!empty($_SERVER["HTTP_CF_IPCOUNTRY"])) {
$country_info = $_SERVER["HTTP_CF_IPCOUNTRY"]);
}
Using Free APIs (be aware of limitations)
http://freegeoip.net/json/$IP (works really slow)
http://ip-api.com/json/$IP (250 requests per minute)
http://www.telize.com/geoip/$IP (no limitation so far)
http://ipinfo.io/$IP/json (Free Daily requests 1,000)
PHP Example to get country from API.
function ip_details($ip) {
$json = file_get_contents("http://ipinfo.io/{$ip}/json");
$details = json_decode($json);
return $details;
}
$details = ip_details("8.8.8.8");
echo $details->city; // => Mountain View
echo $details->country; // => US
echo $details->org; // => AS15169 Google Inc.
echo $details->hostname; // => google-public-dns-a.google.com
Or Maxmind GeoIP. https://github.com/maxmind/GeoIP2-php
Even more resources and links here.
How envato does it http://marketblog.envato.com/news/2015-eu-vat-changes/
If you are Spanish awesome blog post about the new law.