VatEvidence.Vies 1.0.0

dotnet add package VatEvidence.Vies --version 1.0.0
                    
NuGet\Install-Package VatEvidence.Vies -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VatEvidence.Vies" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VatEvidence.Vies" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="VatEvidence.Vies" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VatEvidence.Vies --version 1.0.0
                    
#r "nuget: VatEvidence.Vies, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VatEvidence.Vies@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VatEvidence.Vies&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=VatEvidence.Vies&version=1.0.0
                    
Install as a Cake Tool

eu-vat-evidence

Open-source .NET library for EU VAT number validation and compliance evidence.

Built for developers who need reliable, auditable VAT handling in European B2B applications — without pulling in heavy dependencies or cloud services for basic format checks.


Why this exists

EU VAT compliance is a solved problem in theory and a surprisingly fragmented one in practice. Most libraries either:

  • validate format only, with no path to active-status verification
  • call VIES directly without local pre-validation, wasting network round-trips on obviously invalid numbers
  • bundle everything into one package, forcing you to take HTTP clients when you only need a regex

This project takes a different approach: two focused NuGet packages with zero external dependencies, designed to be composed rather than consumed whole.


Packages

VatEvidence.Core

Local EU VAT number validation. No network calls, no external dependencies.

var result = VatNumberValidator.Validate("HR12345678901");
// VatValidationResult { IsValid, CountryCode, NormalizedVat, ErrorReason }

Covers all 27 EU member states with format validation and checksum verification where applicable (ISO 7064 MOD-11-10, MOD-97, MOD-11, Luhn). Results are deterministic, allocation-efficient, and safe to call from hot paths.

VatEvidence.Vies

EU VIES active-status verification. Calls the EU Commission VIES REST API to confirm whether a VAT number belongs to an active, registered business.

var vies = await viesClient.CheckAsync("HR", "12345678901", cancellationToken);
// ViesResult { IsActive, Name, Address, RequestDate, ErrorReason }

Intentionally decoupled from VatEvidence.Core — take one, the other, or both.


Validation flow

Raw input: "HR12345678901"
         │
         ▼
VatEvidence.Core                 ← fast, local, no network
VatNumberValidator.Validate()
         │
    ┌────┴────┐
  INVALID   VALID
    │          │
  return     VatEvidence.Vies    ← only if format passes
  error      ViesClient.CheckAsync()
                  │
             IsActive, Name, Address

This two-step design means invalid numbers never reach the network, and VIES quota is not wasted on typos or test data.


Stack

  • .NET 10
  • ASP.NET Core Minimal API — reference implementation
  • xUnit — per-country unit tests

Project structure

eu-vat-evidence/
│
├── src/
│   ├── VatEvidence.Core/      # NuGet — validator, country classification
│   └── VatEvidence.Vies/      # NuGet — VIES HTTP client
│
├── VatEvidence.Web/           # Minimal API reference implementation
└── VatEvidence.Test.Unit/     # Per-country validator tests

Country coverage

All 27 EU member states, validated against official EU VAT format specifications:

Prefix Country Checksum
AT Austria
BE Belgium MOD-97
BG Bulgaria
CY Cyprus
CZ Czech Republic
DE Germany MOD-11-10
DK Denmark MOD-11
EE Estonia
EL Greece MOD-11
ES Spain
FI Finland MOD-11
FR France
HR Croatia ISO 7064 MOD-11-10
HU Hungary
IE Ireland
IT Italy Luhn
LT Lithuania
LU Luxembourg MOD-89
LV Latvia
MT Malta
NL Netherlands
PL Poland Weighted
PT Portugal
RO Romania
SE Sweden
SI Slovenia MOD-11
SK Slovakia MOD-11

Getting started

dotnet add package VatEvidence.Core
dotnet add package VatEvidence.Vies   # optional
// Step 1 — local validation, always
var result = VatNumberValidator.Validate(rawInput);

if (!result.IsValid)
    return BadRequest(result.ErrorReason);

// Step 2 — VIES check, only when needed
var vies = await _viesClient.CheckAsync(
    result.CountryCode!,
    result.NormalizedVat![2..],
    cancellationToken);

Register VIES client in DI:

builder.Services.AddHttpClient<IViesClient, ViesClient>();

Evidence records

Beyond validation, the project maintains an append-only SHA-256 hash-chain of VAT check events — designed for audit trails in invoicing and compliance systems where you need to prove a VAT number was valid at the time of a transaction.


License

MIT — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 96 5/26/2026