def vat_checkout_decision(payload):
"""Return (action, reason) for an incoming VAT payload.
accept — format, checksum, and live VIES all agree
accept_pending_retry — format and checksum passed; live check was
inconclusive or skipped. Do not block the buyer.
reject — the number failed a local check, or VIES
returned a definitive invalid.
"""
if not payload.get("success"):
err = payload.get("error") or {}
details = err.get("details") or {}
if err.get("code") == "checksum_failed" or details.get("verdict") == "invalid":
return "reject", "invalid_checksum"
return "reject", err.get("code") or "error"
data = payload["data"]
verdict = data["verdict"]
live = data.get("live_check") or {}
if verdict == "valid":
return "accept", live
if verdict in ("format_valid_unverified", "format_valid"):
return "accept_pending_retry", live
if verdict == "invalid":
return "reject", "invalid"
return "review", verdict
# Captured response: DE number with a valid checksum, VIES member state down.
outage = {
"success": True,
"data": {
"input": "DE811907980",
"country_code": "DE",
"format_valid": True,
"checksum": "passed",
"offline_valid": True,
"vies_eligible": True,
"live_check": {
"performed": True,
"source": "EU VIES",
"status": "member_state_unavailable",
"valid": None,
},
"verdict": "format_valid_unverified",
},
"error": None,
}
print(vat_checkout_decision(outage))
# ('accept_pending_retry', {'performed': True, 'source': 'EU VIES',
# 'status': 'member_state_unavailable', 'valid': None})
If your checkout treats "VIES did not answer" the same as "this VAT number is invalid", a member-state outage will reject buyers whose numbers are well-formed. The other failure mode is to skip the check entirely, which drops the audit trail. The useful split is: reject only a definitive invalid, and when the live registry is down, accept the format provisionally and retry the live check later.
What the live call returns when VIES is down
GET /v1/validate/vat first checks format and check digits locally. Only then does it call the official EU VIES service. When a member state is unavailable, the HTTP status is still 200. live_check.valid is null, and verdict is format_valid_unverified. The payload below was captured earlier through the live API.market gateway (the Business & Tax-ID Validator trial ended on 3 Dec 2026):
curl -G 'https://prod.api.market/api/v1/veriline/business-tax-id-validator/v1/validate/vat' \
--data-urlencode 'vat=DE811907980' \
--data-urlencode 'strict=false' \
-H 'x-api-market-key: YOUR_API_KEY'
{
"success": true,
"data": {
"input": "DE811907980",
"country_code": "DE",
"country_name": "Germany",
"id_type": "USt-IdNr.",
"vat_number": "DE811907980",
"national_number": "811907980",
"format_valid": true,
"checksum": "passed",
"offline_valid": true,
"vies_eligible": true,
"live_check": {
"performed": true,
"source": "EU VIES",
"status": "member_state_unavailable",
"valid": null,
"name": null,
"address": null,
"request_date": "2026-11-24T23:11:58.485Z",
"consultation_number": null
},
"verdict": "format_valid_unverified"
},
"error": null
}
A VIES rate limit looks the same at the verdict layer (format_valid_unverified), with live_check.status set to rate_limited instead. In both cases, live_check.valid is null. That is the signal to queue a retry, not to fail the checkout.
strict=false is the default. If you pass strict=true, an inconclusive live result is raised as an error instead of returning format_valid_unverified. Use that in a back-office job that should stop, not in the request path of a checkout.
Skip VIES when you only need the checksum
For unit tests, or a first pass over a batch of IDs, turn the live call off. The official EU registry is not contacted, so an outage cannot affect the result:
curl -G 'https://prod.api.market/api/v1/veriline/business-tax-id-validator/v1/validate/vat' \
--data-urlencode 'vat=IE6388047V' \
--data-urlencode 'live=false' \
-H 'x-api-market-key: YOUR_API_KEY'
verdict is format_valid and live_check.performed is false. GET /v1/validate/tin with country=IE is the same offline path. Reserve the live VIES call for numbers that already passed this step.
When the live check succeeds
A later captured live call for the well-known Irish number IE6388047V returned verdict: "valid" and the registered name and address from VIES:
{
"success": true,
"data": {
"input": "IE6388047V",
"country_code": "IE",
"vat_number": "IE6388047V",
"format_valid": true,
"checksum": "passed",
"offline_valid": true,
"vies_eligible": true,
"live_check": {
"performed": true,
"source": "EU VIES",
"status": "valid",
"valid": true,
"name": "GOOGLE IRELAND LIMITED",
"address": "3RD FLOOR, GORDON HOUSE, BARROW STREET, DUBLIN 4",
"request_date": "2026-11-25T02:28:03.468Z"
},
"verdict": "valid"
},
"error": null
}
Store live_check.name and live_check.address with the order if you need an audit record. VIES names are often uppercase and may not match a trading name character-for-character.
When the number is actually invalid
A bad check digit never reaches VIES. The gateway returns HTTP 422, and that response does not consume a trial or plan unit:
curl -G 'https://prod.api.market/api/v1/veriline/business-tax-id-validator/v1/validate/vat' \
--data-urlencode 'vat=DE811907981' \
-H 'x-api-market-key: YOUR_API_KEY'
{
"success": false,
"data": null,
"error": {
"code": "checksum_failed",
"message": "USt-IdNr. failed its DE check-digit test",
"details": {
"input": "DE811907981",
"country_code": "DE",
"format_valid": true,
"checksum": "failed",
"offline_valid": false,
"live_check": null,
"verdict": "invalid"
}
}
}
Feed that envelope to the function at the top and you get reject. That is the only case that should block the buyer immediately.
Wiring it into a checkout
- Call
GET /v1/validate/vatwithstrict=false(andlive=true, the default). - Branch on
verdictas invat_checkout_decision. - On
accept, persist the VIES name and address. - On
accept_pending_retry, accept the order or signup, store the VAT number and the VIESstatus, and enqueue a live retry (same endpoint, same number). - On
reject, ask the buyer to correct the number.
The same branch works in JavaScript:
function vatCheckoutDecision(payload) {
if (!payload.success) {
const err = payload.error || {};
const details = err.details || {};
if (err.code === "checksum_failed" || details.verdict === "invalid") {
return { action: "reject", reason: "invalid_checksum" };
}
return { action: "reject", reason: err.code || "error" };
}
const { verdict, live_check: live } = payload.data;
if (verdict === "valid") return { action: "accept", live };
if (verdict === "format_valid_unverified" || verdict === "format_valid") {
return { action: "accept_pending_retry", live };
}
if (verdict === "invalid") return { action: "reject", reason: "invalid" };
return { action: "review", reason: verdict };
}
The API these calls use
The endpoint is the Business & Tax-ID Validator on the Veriline API store. Base URL:
https://prod.api.market/api/v1/veriline/business-tax-id-validator
Send x-api-market-key on every request, including GET /health. Use the prod.api.market host; https://api.market/api/v1/... returns HTTP 421. The Basic plan is a 7-day trial with 100 calls at 1 request per second. Successful 200 responses count toward the quota, including /health. Validation errors (4xx) do not. After the trial, paid plans start at Pro (10,000 calls/month).
The VAT samples in this post were captured earlier through that gateway. The product's free trial ended on 3 Dec 2026, so they were not re-fetched for this write-up. request_id and live_check.request_date are from the original capture and will differ on a new call. VIES availability also changes by member state and time of day.
The same validate_vat tool is exposed by the @verilineapi/mcp server if you would rather call it from Claude Desktop or Cursor. Arguments are vat, optional country, live, and strict.
Top comments (0)