This is a recipe, not a Stripe app and not a marketplace listing. Stripe tells you whether a tax ID passed its check. A webhook handler can add what that check does not say: the register status and legal name of the company behind an EU VAT number, and a review flag, stored in the customer's metadata.
Read from Stripe's documentation on 26 November 2026: "Customer Tax IDs" (docs.stripe.com/billing/customer/tax-ids), the Tax ID object in the API reference and the webhooks guide. Its robots.txt allows reading them. In Stripe's terms:
customer.tax_id.updated for a customer. You inspect data.object.verification.status, which is pending, verified, unverified or unavailable. How to handle unverified is up to you, and when it is unavailable "you must manually verify the tax ID".The same pages do not describe a check of whether the company exists in a company register, whether it is active, in insolvency or sanctioned. Stripe's page is about the tax ID, and this page does not say Stripe should do more. It names the gap a business that sells to companies may want to close for itself.
The stripe npm package (version 23.2.0) types the object: verification is { status, verified_address, verified_name } or null, the owner customer is in customer or owner.customer, and type is one of Stripe's tax ID types (eu_vat among them). Stripe's page lists test numbers for a sandbox: 000000000 verifies, 111111111 does not, 222222222 stays pending.
A VIES valid says the number is registered for VAT in that member state. It does not say the company is trading, solvent or the one your customer named. The register adds the other half: the legal name, the status and the legal form. Our GET /vat/{number} returns the VIES result, and GET /companies/by-identifier?type=vat returns the company record found under the number, with status. On 26 November 2026, for Telefonica's Spanish VAT number:
curl 'https://api.prometiam.com/functions/v1/risk-api/vat/ESA28015865' -H 'Authorization: Bearer rk_live_demo_publichn'
{
"data": {
"vat_number": "ESA28015865", "country_code": "ES", "number": "A28015865",
"is_valid": true, "name": null, "address": null,
"request_date": "2026-11-26T13:48:24.920Z",
"source": "VIES ... (European Commission)",
"registry_match": { "company_id": 59884, "company_name": "TELEFONICA SA", "register": "BORME (Registro Mercantil)", ... }
}
}
VIES answered is_valid: true and withheld the name, as it does for some member states. registry_match is the company our register holds under that number: register data, not a VIES confirmation. The second call, with the same key:
curl 'https://api.prometiam.com/functions/v1/risk-api/companies/by-identifier?type=vat&value=ESA28015865' -H 'Authorization: Bearer rk_live_demo_publichn'
It answered the company record, shortened here to the fields the handler uses: "company_name": "TELEFONICA SA", "status": "active", "legal_form": "SA", "vat_number": "ESA28015865" and "vat_number_source": "rule". rule means the number was built from the Spanish NIF, so the register confirms the company, and VIES (the first call) confirms the VAT registration.
It takes customer.tax_id.created and customer.tax_id.updated events, verifies Stripe's signature with the library, handles eu_vat numbers, makes the two calls, and writes six keys of customer metadata with stripe.customers.update: prometiam_vies, prometiam_register_status, prometiam_legal_name, prometiam_vat_source, prometiam_review (none or review), prometiam_review_reasons. Any other tax ID type is flagged for review without a call. The key is read from the environment. Node 20 or later and npm install stripe.
const http = require('node:http');
const Stripe = require('stripe');
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || 'sk_test_placeholder');
const ENDPOINT_SECRET = process.env.STRIPE_WEBHOOK_SECRET;
const API = 'https://api.prometiam.com/functions/v1/risk-api';
const HEAD = { Authorization: `Bearer ${process.env.PROMETIAM_API_KEY}` };
async function get(path) {
const r = await fetch(API + path, { headers: HEAD });
return { status: r.status, body: await r.json().catch(() => ({})) };
}
// Two Prometiam calls, 1 credit each: VIES through /vat, the register through /companies/by-identifier.
async function check(vat) {
const reasons = [];
const v = await get(`/vat/${encodeURIComponent(vat)}`);
if (v.status === 503 || v.status === 429) throw new Error(`Prometiam ${v.status}`); // answer 5xx so Stripe retries
const vies = v.status === 200 ? (v.body.data.is_valid ? 'valid' : 'invalid') : 'not_checked';
if (vies !== 'valid') reasons.push(`vies_${vies}`);
const c = await get(`/companies/by-identifier?type=vat&value=${encodeURIComponent(vat)}`);
if (c.status === 429 || c.status >= 500) throw new Error(`Prometiam ${c.status}`);
let status = 'not_found', name = '', source = '';
if (c.status === 200) {
status = c.body.data.status || 'unknown';
name = c.body.data.company_name || '';
source = c.body.data.vat_number_source || '';
if (status !== 'active') reasons.push(`register_${status}`);
} else {
reasons.push(`register_${c.status === 404 ? 'not_found' : 'error_' + c.status}`);
}
return {
prometiam_vies: vies,
prometiam_register_status: status,
prometiam_legal_name: name,
prometiam_vat_source: source, // "rule" means the number was built from the identifier, not confirmed
prometiam_review: reasons.length ? 'review' : 'none',
prometiam_review_reasons: reasons.join(','),
};
}
async function onTaxId(taxId) {
if (taxId.type !== 'eu_vat') { // this recipe covers eu_vat; anything else goes to a person
return { prometiam_review: 'review', prometiam_review_reasons: `type_${taxId.type}_not_checked` };
}
const md = await check(taxId.value);
if (taxId.verification && taxId.verification.status !== 'verified') {
md.prometiam_review = 'review';
md.prometiam_review_reasons = [md.prometiam_review_reasons, `stripe_${taxId.verification.status}`].filter(Boolean).join(',');
}
return md;
}
http.createServer((req, res) => {
const chunks = [];
req.on('data', (c) => chunks.push(c));
req.on('end', async () => {
let event;
try {
event = stripe.webhooks.constructEvent(Buffer.concat(chunks), req.headers['stripe-signature'], ENDPOINT_SECRET);
} catch (e) { res.writeHead(400).end(); return; } // bad signature: nothing else runs
if (event.type !== 'customer.tax_id.updated' && event.type !== 'customer.tax_id.created') { res.writeHead(200).end(); return; }
try {
const taxId = event.data.object;
const customer = taxId.customer || (taxId.owner && taxId.owner.customer);
const metadata = await onTaxId(taxId);
if (process.env.DRY_RUN) console.log('would write to', customer, JSON.stringify(metadata));
else await stripe.customers.update(customer, { metadata }); // needs a Stripe account: not run for this page
res.writeHead(200).end('ok');
} catch (e) { console.error(e.message); res.writeHead(500).end(); }
});
}).listen(process.env.PORT || 8081);
One thing to change before production: Stripe's webhooks page says to return a 2xx quickly, before any complex logic. This sample does its two calls (about two seconds) before answering to stay short. Answer 200 first and do the work from a queue. The same page says Stripe retries a delivery for up to three days in live mode, so a 500 on a failed call is not lost.
The handler ran locally in dry-run mode (DRY_RUN=1). Two test events were built by hand, with the shape of the Stripe tax ID object and signed with the library's own helper, stripe.webhooks.generateTestHeaderString, and constructEvent verified them. Two further posts, one signed with another secret and one with an altered body, were refused with 400. A tax ID whose verification is still pending is flagged stripe_pending until the updated event follows. The two valid events called our API live with the demo key (4 credits in all). The write to Stripe was not run: it needs a Stripe account and a secret key, so the line stripe.customers.update was replaced by a print of what it would send:
signed -> 200
would write to cus_local {"prometiam_vies":"valid","prometiam_register_status":"active","prometiam_legal_name":"TELEFONICA SA","prometiam_vat_source":"rule","prometiam_review":"none","prometiam_review_reasons":""}
bad signature -> 400
altered body -> 400
would write to cus_local {"prometiam_vies":"invalid","prometiam_register_status":"not_found","prometiam_legal_name":"","prometiam_vat_source":"","prometiam_review":"review","prometiam_review_reasons":"vies_invalid,register_not_found,stripe_unverified"}
signed, second number -> 200
The first event is Telefonica's number marked verified by Stripe. The second is a made-up Spanish number (ESB00000000, not a real company) marked unverified: VIES says invalid, the register has no such company, and Stripe's own status is added to the reasons. Stripe's real events were not used, so the exact verification values for a real customer are the ones in Stripe's documentation, not observed here.
GET /vat/{number} and 1 for GET /companies/by-identifier. An error costs nothing.created and updated, so one new tax ID can cost 4 credits if you handle both. Handle only updated if the verification result is what you wait for.prometiam_review is a flag for a person.GET /vat/{number} covers the 27 EU member states and Northern Ireland. VIES has no Norway or Switzerland, and GB VAT is out of scope here, so no_vat, ch_vat and gb_vat are not checked by this handler.vat_number_source rule) has the right format; its registration is confirmed only by VIES.GET /sanctions/screen, 3 credits, beta, not in the demo key) that this recipe does not make, and it covers listed names, not a clearance.The free trial lasts 14 days and includes 500 credits. A card is required and nothing is charged during the trial; it then continues as Starter (EUR 9.99/month) unless you cancel.