Check the validity of a VAT number

Go VAT

GitHub go.mod Go version of a Go module Maintenance

Check the validity of a VAT number without any HTTP request.

This go library is based on the original jsVAT for JS/TS.

The intention of this library is to offer to all gophers the ability to validate all the VAT numbers before they are stored in a database.

βš™οΈ Installation

Go v1.17.x or newer (RECOMMENDED)

go install github.com/ltns35/go-vat

Go v1.16.x or older

go get -u github.com/ltns35/go-vat

🎯 Features

  • Check the validity of VAT numbers.
  • Display with format.
  • Retrieve the list of available taxes for each country.
  • Extendable with custom countries/rules
  • Offline

πŸ“š How to use

// Check against all supported countries validators.
vatResult, err := vat.CheckVAT("ADE000000E")
if err != nil {
// Handle error
}

// Check ONLY against Andorra validator.
countries := []countries.Calculer{
andorra.VAT,
}
vatResult, err = vat.CheckVAT("ADE000000E", countries...)

// output: vatResult
//
//	{
//	   "value":"ADF000000F",
//	   "isValid":true,
//	   "isSupportedCountry":true,
//	   "country":{
//	      "name":"Andorra",
//	      "codes":[
//	         "AD",
//	         "AND",
//	         "020"
//	      ],
//	      "rules":{
//	         "multipliers":null,
//	         "typeFormats":null,
//	         "lookup":null,
//	         "check":"",
//	         "regex":[
//	            "^(AD)([fealecdgopuFEALECDGOPU]{1}\\d{6}[fealecdgopuFEALECDGOPU]{1})$"
//	         ],
//	         "additional":null
//	      }
//	   }
//	}
//

🌍 Supported countries

  • Albania
  • Andorra
  • Argentina
  • Austria
  • Belarus
  • Belgium
  • Bolivia
  • Brazil
  • Bulgaria
  • Canada
  • Croatia
  • Cyprus
  • Czech Republic
  • Denmark
  • Ecuador
  • Estonia
  • Europe
  • Finland
  • France
  • Germany
  • Greece
  • Guatemala
  • Hungary
  • Hong Kong
  • India
  • Indonesia
  • Ireland
  • Italy
  • Kazakhstan
  • Korea, Republic of
  • Latvia
  • Liechtenstein
  • Lithuania
  • Luxembourg
  • Malaysia
  • Malta
  • Netherlands
  • New Zealand
  • Nigeria
  • North Macedonia
  • Norway
  • Peru
  • Poland
  • Portugal
  • Romania
  • Russia
  • San Marino
  • Serbia
  • Slovakia
  • Slovenia
  • Spain
  • Sweden
  • Switzerland
  • Taiwan
  • Turkey
  • Ukraine
  • United Kingdom
  • Uruguay

🧭 Need an unsupported country

If you need a country is not yet supported by the library open a new issue or create a pull request to be merged.

πŸ§ͺ Testing

The library is tested against the 2 latest stable major versions of Go.

  • 1.17.x
  • 1.16.x

All the validators has been tested individually to ensure the correct working, if you need more tests don't hesitate to open a new issue with the values you want to be tested.

⚠️ LICENSE

The library is under the MIT license, so you can use it for free for commercial products.

Similar Resources

A tool to determine the highest version number that's smaller than a target version number

semver-highest A tool to determine the highest version number that's smaller than a target version number. Installation go install github.com/marten-s

Oct 13, 2021

A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy

A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy

Fake-SMS A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a pr

Dec 31, 2022

Converts a number to its English counterpart. Uses arbitrary precision; so a number of any size can be converted.

Converts a number to its English counterpart. Uses arbitrary precision; so a number of any size can be converted.

Dec 14, 2021

Iran National Id, Bank Card Number, Mobile Number Validator for golang

Iran IDValidator Iran National Id, Bank Card Number, Mobile Number Validator for golang Installation go get -u github.com/mohammadv184/idvalidator Us

Dec 20, 2021

Divide (distribute) the given number (n) into number (p) of parts randomly,

Number Split Randomly The sample code written in Go lang Executables This repo already have executables for Linux and windows, after clone the repo ju

Feb 4, 2022

Using NFP (Number Format Parser) you can get an Abstract Syntax Tree (AST) from Excel number format expression

NFP (Number Format Parser) Using NFP (Number Format Parser) you can get an Abstract Syntax Tree (AST) from Excel number format expression. Installatio

Feb 4, 2022

Toy project to test golang toolset, using as pretext the "cyclic number" problem (famous 142857 number)

go-cyclic-number Toy project to test golang toolset, using as pretext the "cyclic number" problem (famous 142857 number) First version: https://github

Feb 12, 2022

check-cert: Go-based tooling to check/verify certs

check-cert: Go-based tooling to check/verify certs

Dec 6, 2022

Check-location - A golang service to check user location using their IP address

this is a golang service to check user location using their IP address. The purp

Aug 29, 2022

Check-load - Simple cross-platform load average check

Sensu load average check Table of Contents Overview Usage examples Configuration

Jun 16, 2022

A package for Go that can be used for range queries on large number of intervals

go-stree go-stree is a package for Go that can be used to process a large number of intervals. The main purpose of this module is to solve the followi

May 14, 2022

Fast thread-safe inmemory cache for big number of entries in Go. Minimizes GC overhead

fastcache - fast thread-safe inmemory cache for big number of entries in Go Features Fast. Performance scales on multi-core CPUs. See benchmark result

Dec 30, 2022

Source code editor written in Go using go-gtk bindings. It aims to handle navigation effectively among large number of files.

Source code editor written in Go using go-gtk bindings. It aims to handle navigation effectively among large number of files.

tabby Source code editor written in Go using go-gtk bindings. It aims to handle navigation effectively among large number of files. screenshot: depend

Nov 16, 2022

Powerful and versatile MIME sniffing package using pre-compiled glob patterns, magic number signatures, XML document namespaces, and tree magic for mounted volumes, generated from the XDG shared-mime-info database.

mimemagic Powerful and versatile MIME sniffing package using pre-compiled glob patterns, magic number signatures, xml document namespaces, and tree ma

Nov 3, 2022

Limits the number of goroutines that are allowed to run concurrently

Golang Concurrency Manager Golang Concurrency Manager package limits the number of goroutines that are allowed to run concurrently. Installation Run t

Dec 12, 2022

Port of D. J. Bernstein's primegen prime number generator to Go

primegen primegen is a Go package that generates prime numbers in order using the Sieve of Atkin instead of the traditional Sieve of Eratosthenes. It

Jul 20, 2021

Package strit introduces a new type of string iterator, along with a number of iterator constructors, wrappers and combinators.

strit Package strit (STRing ITerator) assists in development of string processing pipelines by providing a simple iteration model that allows for easy

Jun 21, 2022

fastcache - fast thread-safe inmemory cache for big number of entries in Go

Fast thread-safe inmemory cache for big number of entries in Go. Minimizes GC overhead

Dec 27, 2022

High performance unique number generator powered by Go

SEQSVR High performance unique number generator powered by Go δΈ­ζ–‡ README Features Distributed: Can be scaled horizontally High performance: Allocation

Nov 16, 2022
Comments
  • Refactor (BREAKING CHANGE)

    Refactor (BREAKING CHANGE)

    Refactor of the structure project.

    The new structure of the project will break the current one. Now when you are referencing a country VAT you are using countryName.VAT, the new behaviour will be countries.CountryName. This was the previous structure, but was changed due to naming collisions and to add more features (taxes) to a specific country, but some users didn't like it.

Iran National Id, Bank Card Number, Mobile Number Validator for golang

Iran IDValidator Iran National Id, Bank Card Number, Mobile Number Validator for golang Installation go get -u github.com/mohammadv184/idvalidator Us

Dec 20, 2021
Simple module for validation inn control number

simple module for validation inn control number

Sep 4, 2022
Provide check digit algorithms and calculators written in Go

checkdigit About Provide check digit algorithms and calculators written by Go. Provided methods Algorithms Luhn Verhoeff Damm Calculators ISBN-10 ISBN

Dec 17, 2022
Go package for dealing with EU VAT. Does VAT number validation & rates retrieval.

Package vat Package for validating VAT numbers & retrieving VAT rates in Go. Installation Use go get. go get github.com/dannyvankooten/vat Then impor

Dec 6, 2022
Guess-number-game - Computer thoughts of some integer number, you must guess it with limited number of attempts
Guess-number-game - Computer thoughts of some integer number, you must guess it with limited number of attempts

Guess number game Rules Computer has thought of some integer number. You must guess it, you have numberOfAttempts attempts. How to run Just type in co

Dec 31, 2021
Key-Checker - Go scripts for checking API key / access token validity
Key-Checker - Go scripts for checking API key / access token validity

Key-Checker Go scripts for checking API key / access token validity Update V1.0.0 ?? Added 37 checkers! Screenshoot ?? How to Install go get github.co

Dec 19, 2022
Vat ID Validator for Germany

German Vat Validator service This project has been developed using Hexagonal architecture and repository pattern. How to run? docker-compose up -d Cal

Nov 4, 2021
PiHex Library, written in Go, generates a hexadecimal number sequence in the number Pi in the range from 0 to 10,000,000.

PiHex PiHex Library generates a hexadecimal number sequence in the number Pi in the range from 0 to 1.0e10000000. To calculate using "Bailey-Borwein-P

Nov 18, 2022
A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy.
A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy.

Fake-SMS A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a pr

Dec 31, 2022
MNA - stands for mobile number assignment - a small zero external dependency golang library that is used to identify mobile number assignment in tanzania

MNA - stands for mobile number assignment - a small zero external dependency golang library that is used to identify mobile number assignment in tanzania

Nov 29, 2021