Skip to main content

Offline VAT rates and validation for 44 countries — EU-27, UK, Switzerland, Norway, and more. Real checksum validation, not just regex.

Project description

vatverify-rates

PyPI Python Versions License: MIT

Offline VAT number validation and VAT rates for 44 countries. Real checksum algorithms (MOD97, MOD11, Luhn, HMRC 97-55), not just regex. Zero runtime dependencies, pure Python, fully type-annotated.

For live validation (VIES / HMRC / CH UID / Brønnøysund), use this package as the format/checksum pre-check in front of the hosted vatverify API.

Install

pip install vatverify-rates

Usage

Look up a rate

from vatverify_rates import get_standard_rate, get_rate

get_standard_rate("DE")    # 19.0
get_standard_rate("FR")    # 20.0

rate = get_rate("DE")
# Rate(country_code='DE', country='Germany', standard=19.0, reduced=(7.0,), ...)

Validate a VAT number

from vatverify_rates import validate

result = validate("IE6388047V")
if result.valid:
    print("valid")
else:
    print("invalid:", result.errors)

Country utilities

from vatverify_rates import country_name, is_eu_member, get_flag

country_name("DE")     # 'Germany'
is_eu_member("CH")     # False
is_eu_member("DE")     # True
get_flag("FR")         # '🇫🇷'

Types

from vatverify_rates import Rate, ValidateResult, CountryCode

Rate and ValidateResult are @dataclass(frozen=True, slots=True). CountryCode and EUMemberCode are Literal unions of ISO-2 codes.

API

Function Returns
get_rate(code) Rate | None
get_standard_rate(code) float | None
get_all_rates() dict[str, Rate]
country_name(code) str | None
country_name_local(code) str | None
is_eu_member(code) bool
is_known_country(code) bool
get_flag(code) str (emoji or "")
validate_format(vat, country=None) bool
validate_checksum(vat, country=None) bool
validate(vat, country=None) ValidateResult
data_version str (ISO date of latest refresh)

Supported countries

Group Codes
EU-27 AT, BE, BG, CY, CZ, DE, DK, EE, EL, ES, FI, FR, HR, HU, IE, IT, LT, LU, LV, MT, NL, PL, PT, RO, SE, SI, SK
UK & protocol GB, XI
EFTA CH, LI, NO, IS
Micro-states AD
Candidate / other AL, BA, ME, MK, RS, TR, MD, UA, XK, GE

Greece uses EL per VIES convention. XI is Northern Ireland under the Brexit protocol.

Offline vs live

Offline checks (format + checksum) catch typos and fraudulent-looking numbers, but cannot confirm a number is registered with a tax authority. That requires a live registry call. The hosted vatverify API handles VIES, HMRC, BFS, and Brønnøysund, with freshness-aware responses so a registry outage never breaks your checkout.

Other languages

Same data, same functions, idiomatic per language:

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vatverify_rates-0.1.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vatverify_rates-0.1.0-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file vatverify_rates-0.1.0.tar.gz.

File metadata

  • Download URL: vatverify_rates-0.1.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vatverify_rates-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c31d5e1d7a2801ff55a5a158b52de8a3f0176ea828691daddda279ea14b1dec8
MD5 64608579e487068fb54ae3c509c54b0e
BLAKE2b-256 75f97fef0687d4a776e06129187beca322e0b541125c6cfbaaee27d9b5a1e60d

See more details on using hashes here.

Provenance

The following attestation bundles were made for vatverify_rates-0.1.0.tar.gz:

Publisher: publish.yml on vatverify/vat-rates-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vatverify_rates-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vatverify_rates-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vatverify_rates-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 991791ea4d17f65050e5891d0972766cc51c33d8e6652db7c3f2cc3e33e1770c
MD5 d941722257ea9b091a0e7623bd684579
BLAKE2b-256 dd5f46df03ede94eb424e5f328f0f47637704280d5dba32d97d2a9377188ba7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for vatverify_rates-0.1.0-py3-none-any.whl:

Publisher: publish.yml on vatverify/vat-rates-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page