Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EU & UK VAT Validator & Rate Engine — TypeScript / JavaScript SDK

npm version License: MIT Stanza API

Deterministic offline checksum validator for EU-27 and UK VAT numbers with instant 2026 standard & reduced tax rate lookups.

Official, zero-dependency Node.js and TypeScript client for EU & UK VAT Validator & Rate Engine, powered by the Stanza Micro-API Network. Delivers deterministic, sub-5ms V8 isolate execution directly to your application without 3rd-party proxies.


📦 Installation

npm install @stanzaapi/vat-validator
# or
pnpm add @stanzaapi/vat-validator
# or
yarn add @stanzaapi/vat-validator

🚀 Quickstart

import { VatValidatorClient } from '@stanzaapi/vat-validator';

// Initialize client (API key optional for sandbox tier evaluation)
const client = new VatValidatorClient({
  apiKey: process.env.STANZA_API_KEY,
});

async function main() {
  const result = await client.validate('DE123456789');

  if (result.success) {
    console.log('Verification Success:', result.data);
  } else {
    console.error('Validation Error:', result.error, result.code);
  }
}

main().catch(console.error);

📄 Example JSON Response

{
  "success": true,
  "data": {
    "valid": true,
    "vat_number": "DE123456789",
    "country_code": "DE",
    "standard_rate": 19,
    "reduced_rate": 7
  }
}

⚙️ Client Configuration Options

Option Type Default Description
apiKey string process.env.STANZA_API_KEY Your Stanza API Key. Required for high-throughput production tiers.
baseUrl string https://api.stanzaapi.com/vat-validator Public edge API base URL.
timeoutMs number 15000 Request timeout in milliseconds (uses native AbortSignal.timeout).

🛡️ Response Envelope & Error Handling

All responses return a typed envelope:

export interface ApiResponse<T> {
  success: boolean;
  data?: T;
  error?: string;
  code?: 'VALIDATION_ERROR' | 'UNAUTHORIZED' | 'PAYLOAD_TOO_LARGE' | 'RATE_LIMITED' | 'INTERNAL_ERROR';
}

🔗 Related Resources

📄 License

MIT © Stanza — Powered by Stanza.

Releases

Packages

Contributors

Languages