npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vies-vat

v1.2.4

Published

A EU VAT Number validation via European Union VIES API including company information

Downloads

124

Readme

VIES-VAT - European VAT Number Validation

What is VIES-VAT ?

A lightweight quick and easy to use NPM package written in node.js A simple request with country code & VAT number ( timeout & debug optional ) will allow you to verify the validity of a VAT number issued by any European Union Member State via the VIES System. The returned response will show whether the VAT number is valid or not and any extra company information where available.

What is VIES ?

VIES (VAT Information Exchange System) is an electronic means of validating VAT-identification ( VATIN ) numbers of economic operators registered in the European Union for cross border transactions on goods or service.

Integration Support

Contact the developer at [email protected]

Get started

npm install --save vies-vat

Valid CountryCodes

AT BE BG HR CY CZ DK EE FI FR DE EL HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE XI

Callback example

var vies = require('VIES-VAT');

var viesOptions = {
    countryCode: 'xx', // ie FR
    vatNumber: 'xxxxxx', // vat Number without country code
    timeout: 10000 // optional - default 30000 ( 30 seconds )
};

vies(viesOptions, function (error, viesInfo) {
    if (error) console.log('vies callback test - error ', error);

    console.log('vies callback test ', viesInfo);
});

async/await example

var vies = require('VIES-VAT');

awaitTest();
async function awaitTest() {
    var viesOptions = {
        countryCode: 'xx', // ie FR
        vatNumber: 'xxxxxx', // vat Number without country code
        timeout: 10000 // optional - default 30000 ( 30 seconds )
    };

    var res = await vies(viesOptions);
    if (res.error) console.log('vies sync test - error ', res.error);

    console.log('vies sync test Result ', res.viesInfo);
}
Valid Response
{
  valid: true,
  countryCode: 'xx',
  vatNumber: 'xxxxxxx',
  requestDate: '2022-12-08+01:00',
  name: 'Company Name', // if available
  address: 'Company Address' // if available
}
Invalid Response
{
  valid: false,
  countryCode: 'xx',
  vatNumber: 'xxxxxxxxxx',
  requestDate: '2022-12-08+01:00',
  name: false,
  address: false,
  error : 'Error message'
}
Error Messages
'vies Badly formed request - Check vatNumber & countryCode';
'vies Badly formed request - vatNumber is empty';
'vies Badly formed request - countryCode is empty';
'vies Badly formed request - Not EU Country';
'vies vies call error';
'vies Timeout';
Debug

Add the Debug key to your options This will give more details of the call including errors

debugTest();
async function debugTest() {
    var viesOptions = {
        countryCode: 'xx', // ie FR
        vatNumber: 'xxxxxx', // vat Number without country code
        timeout: 60000, // optional - default 30000 ( 30 seconds )
        debug: true // optional - default false
    };
    var res = await vies(viesOptions);
    if (res.error) console.log('vies debug test - error ', res.error);
    console.log('vies debug test Result ', res.viesInfo);
}

Common Issues

Receive Error when testing a valid VAT Number

This could be an internet connection issue or dns lookup Check that you can ping 'ec.europa.eu' from your server Add the following entry to your host file:- 147.67.34.30 ec.europa.eu

Change Log

1.2.4

Fix Parsing Issue

1.2.2

Apply EU Updates

1.2.1

Make for public use on GITHUB

License

The MIT License (MIT)

Copyright (c) 2023 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.