Socket
Socket
Sign inDemoInstall

vies-vat

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vies-vat

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


Version published
Weekly downloads
21
decreased by-56.25%
Maintainers
1
Install size
12.8 kB
Created
Weekly downloads
 

Readme

Source

VIES-VAT - European VAT Number Validation

VIES-VAT status Badge VIES-VAT license Badge VIES-VAT license Badge VIES-VAT twitter Badge

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 bitinix@gmail.com

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 bitinix@gmail.com

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.

Keywords

FAQs

Last updated on 26 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc