- Notifications
You must be signed in to change notification settings - Fork1
European VIES VAT number validator
License
NotificationsYou must be signed in to change notification settings
itaibo/vies-checker
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
European VIES VAT number validator (https://ec.europa.eu/taxation_customs/vies)
npm install vies-checker
const{ isValid}=require('vies-checker');import{isValid}from'vies-checker';
constCOUNTRY_CODE='IT';constVAT_NUMBER='B12345678';// isValid returns a boolean. If something is wrong, it will throw an errortry{constvalidVAT=awaitisValid(COUNTRY_CODE,VAT_NUMBER);console.log(`VAT number${(validVAT ?'is' :'is not')} in VIES`);}catch(e){console.error(e);}
These are the errors that might occur. Use a try/catch to handle them properly.
Error name | Description |
---|---|
GLOBAL_MAX_CONCURRENT_REQ | Your Request for VAT validation has not been processed; the maximum number of concurrent requests has been reached |
MS_MAX_CONCURRENT_REQ | Your Request for VAT validation has not been processed; the maximum number of concurrent requests for this Member State has been reached |
SERVICE_UNAVAILABLE | An error was encountered either at the network level or the Web application level, try again later |
MS_UNAVAILABLE | The application at the Member State is not replying or not available |
TIMEOUT | The application did not receive a reply within the allocated time period, try again later |
Thanks to@pano9000 forpointing out these errors
About
European VIES VAT number validator