3.1.0 • Published 1 year ago

vies-checker v3.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

VIES checker

EU API Works

European VIES VAT number validator (https://ec.europa.eu/taxation_customs/vies)

Installation

npm install vies-checker

Usage

Require/Import the module

const { isValid } = require('vies-checker');

import { isValid } from 'vies-checker';

Use the isValid function

const COUNTRY_CODE = 'IT';
const VAT_NUMBER = 'B12345678';

// isValid returns a boolean. If something is wrong, it will throw an error
try {
  const validVAT = await isValid(COUNTRY_CODE, VAT_NUMBER);
  console.log(`VAT number ${(validVAT ? 'is' : 'is not')} in VIES`);
} catch (e) {
  console.error(e);
}

Errors

These are the errors that might occur. Use a try/catch to handle them properly.

Error nameDescription
GLOBAL_MAX_CONCURRENT_REQYour Request for VAT validation has not been processed; the maximum number of concurrent requests has been reached
MS_MAX_CONCURRENT_REQYour Request for VAT validation has not been processed; the maximum number of concurrent requests for this Member State has been reached
SERVICE_UNAVAILABLEAn error was encountered either at the network level or the Web application level, try again later
MS_UNAVAILABLEThe application at the Member State is not replying or not available
TIMEOUTThe application did not receive a reply within the allocated time period, try again later

Thanks to @pano9000 for pointing out these errors

3.1.0

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

2.0.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago