Home / Use cases / Stripe

Stripe

Validate EU VAT numbers in Stripe Checkout

Add EU VAT validation to your Stripe checkout flow. Verify customer VAT numbers server-side before applying B2B zero-rate exemptions, ensuring you only exempt valid registered businesses.

Implementation steps

  1. 1

    Collect VAT number at checkout

  2. 2

    Validate via TaxID API

  3. 3

    Apply zero-rate if valid

  4. 4

    Store result on Stripe customer metadata

Code example

Node.js

// After collecting the VAT number from your Stripe checkout form
const validateVAT = async (country, vatNumber) => {
  const res = await fetch(
    `http://localhost:3000/api/v1/validate/${country}/${vatNumber}`,
    { headers: { 'Authorization': `Bearer ${process.env.TAXID_API_KEY}` } }
  );
  return res.json();
};

// In your Stripe payment_intent creation handler
const { valid, company_name } = await validateVAT('DE', req.body.vatNumber);
if (valid) {
  // Customer is a valid EU business — apply zero-rate / reverse charge
  await stripe.customers.update(customerId, {
    tax_exempt: 'reverse',
    metadata: { vat_number: req.body.vatNumber, vat_company: company_name }
  });
}

Python

import requests
import stripe

def validate_vat(country: str, vat_number: str) -> dict:
    response = requests.get(
        f"http://localhost:3000/api/v1/validate/{country}/{vat_number}",
        headers={"Authorization": f"Bearer {TAXID_API_KEY}"}
    )
    return response.json()

# In your checkout handler
result = validate_vat("DE", request.json["vat_number"])
if result["valid"]:
    stripe.Customer.modify(customer_id, tax_exempt="reverse",
        metadata={"vat_number": vat_number, "company": result["company_name"]}
    )

API response

The TaxID API returns a consistent JSON response for every validation request:

200 OK (active)valid
{
  "valid": true,
  "status": "active",
  "country_code": "DE",
  "vat_number": "123456789",
  "company_name": "Example GmbH",
  "company_address": "Musterstraße 1, 10115 Berlin",
  "request_date": "2026-05-10T00:00:00.000Z",
  "cached": false,
  "request_id": "req_01j..."
}

Error handling

The API uses a consistent Stripe-style error format. Always handle service_unavailable separately — VIES has occasional downtime and you should not reject valid customers during outages.

active

VAT number is valid and the business is registered

invalid

VAT number format is wrong or not registered in VIES

service_unavailable

VIES or the national system is temporarily down — retry later

Ready to implement?

Get your free API key and start validating EU VAT numbers today.

Get free API key