The Vat API can be used to calculate VATs on goods, validate a company’s VAT number, and get the latest VAT rates for product categories in a country. In abstract-python, the VatAPI class is used to communicate with this API.

Endpoints

Supported currency codes

AbstractAPI supports ISO 4217 currency codes for the VAT API which can be found here

Get currency codes

With abstract-python you can get the supported country codes as a Python List. See usage below:

from abstract_python import VAT_SUPPORTED_COUNTRIES

print(VAT_SUPPORTED_COUNTRIES)

Below is the result:

>>> [
    "AT", "BE", "BG", "CY", "CZ", "DE", "DK", "EE", "EL", "ES", "FI", "FR", "HR",
    "HU", "IR", "IT", "LT", "LU", "LV", 
    "MT", "NL", "PL", "PT", "RO", "SE", "SI", "SK", "XI",
    ]

Use case

If your app receives country codes from users, you may need to validate these inputs before querying the VatAPI class.

See usage below:

from abstract_python import VAT_SUPPORTED_COUNTRIES

country_code = input("Enter a country code")

if country code in VAT_SUPPORTED_COUNTRIES:
    # continue with the app logic
else:
    print(f"{country_code} is not a supported country code")

The code above is a simple console-based program. This technique can also be extended to other programs such as a web app or desktop app.

Error messages

Refer to this page for all possible error messages you may encounter while using the VatAPI class.