Check a business customer in your e-shop
When a company buys from you, your server fills in its name and address from the registry at registration or checkout, checks its VAT number in VIES and shows whether anything is wrong with it. Below is every call with a real response, and a client in PHP and JavaScript.
What you need and when
| Step | Call | What it answers |
|---|---|---|
| 1. Autocomplete | /companies/autocomplete | Which company the customer means. |
| 2. Billing details | /companies/{ico} | Name, address, VAT number from the registry. |
| 3. VAT number | /vat/validate | Is the VAT number valid in VIES right now. |
| 4. Risk | /companies/{ico}/compliance | Unreliable VAT payer, insolvency, liquidation, sanctions. |
| 5. Payment terms | /companies/{ico}/credit-score | Invoice on terms, prepayment, or refuse. Optional. |
| 6. Watching | /monitoring/subscriptions | A webhook when the company changes later. Optional. |
Always send the country. The same IČO can exist in Slovakia and in the Czech Republic, and without ?country= we return the active one, with Slovakia first.
IČO autocomplete
Your form sends what the customer typed to your own endpoint and your server passes it on. Wait for at least two characters and for a pause in typing.
curl -H "Authorization: Bearer $ENTYRIX_API_KEY" \ "https://entyrix.com/api/v1/companies/autocomplete?q=alza&country=CZ&limit=3"
{
"data": [
{
"ico": "27082440",
"name": "Alza.cz a.s.",
"municipality": "Praha",
"address": "Jankovcova 1522/53, Holešovice, 17000 Praha 7",
"status": "active",
"country": "CZ",
"subjectType": "legal_entity"
}
]
}
Show the name, IČO and town in the list; the town is what tells apart companies of one group with almost the same name. status says whether the company is active, in liquidation or dissolved.
Every call with a key counts towards the monthly quota, autocomplete included (Free has 1,000 a month). A call per keystroke uses it up in a few dozen registrations.
Billing details
Fill the invoice fields from the registry, so the customer does not have to type them.
curl -H "Authorization: Bearer $ENTYRIX_API_KEY" \ "https://entyrix.com/api/v1/companies/27082440?country=CZ"
// trimmed to the fields an invoice needs
{
"data": {
"ico": "27082440",
"name": "Alza.cz a.s.",
"address": "Jankovcova 1522/53, Holešovice, 17000 Praha 7",
"street": "Jankovcova",
"buildingNumber": "1522/53",
"postalCode": "17000",
"municipality": "Praha",
"country": "CZ",
"dic": "CZ27082440",
"vatId": "CZ27082440",
"status": "active"
}
}
Use vatId for the VAT number. It is already in the VIES form (country prefix + number); dic and icDph are national forms and differ between countries. A missing vatId means we do not know the company as a VAT payer.
VAT number in VIES
We ask VIES, the EU system that validates VAT numbers, at the moment you call. Run it before you invoice another EU country without VAT.
curl -H "Authorization: Bearer $ENTYRIX_API_KEY" \ "https://entyrix.com/api/v1/vat/validate?country=CZ&vatin=27082440"
// valid
{
"data": {
"country": "CZ", "vatin": "27082440", "isValid": true,
"name": "Alza.cz a.s.",
"address": "Jankovcova 1522/53\nPRAHA 7 - HOLEŠOVICE\n170 00 PRAHA 7",
"checkedAt": "2026-10-30T14:05:21.851Z", "source": "vies",
"provisional": false, "proof": "none"
},
"meta": { "duration_ms": 3503, "cached": false }
}
// SLOVNAFT, a.s. is in a VAT group: valid, but VIES returns the group, not the company
{
"data": {
"country": "SK", "vatin": "7120001713", "isValid": true,
"name": "Group registration - This VAT ID corresponds to a Group of Taxpayers",
"address": "N/A"
}
}
// not a VAT number
{ "data": { "country": "CZ", "vatin": "12345679", "isValid": false, "name": "", "address": "" } }
| Result | When | What to show |
|---|---|---|
| valid | isValid: true | Verified, with the time of the check. |
| invalid | isValid: false | Not a valid VAT number. Charge VAT or ask the customer. |
| unverified | 503 VIES_UPSTREAM_ERROR, timeout | VIES or the member state is down. Show “unverified” and try again later. |
VIES answers in a few seconds (3.5 s for a CZ number when we measured), so check after the form is submitted, not while typing. We cache each answer for 24 hours; ?force=1 asks VIES again.
Compare the name from VIES with the name in the order only as a hint. VAT groups return the group, not the company (SLOVNAFT in the example), and some states return no name at all. When the name differs, have a person look at the order.
Store isValid, checkedAt and consultationNumber with the order. VIES issues the consultation number only when you send your own VAT number in the requester parameter. It is your proof for a tax audit that you checked the customer on that day, so such a call always goes to VIES and never comes from our cache.
Look at source in the answer. vies means the answer came from VIES. When VIES or the member state is down, we try up to three times and then check the national VAT register (CZ, SK, RO, FI, LV). If the register confirms the registration, source is national_registry, provisional is true and proof is none, together with the register, the date of its data and the VIES error. The register confirms a domestic VAT registration on that date, not validity for intra-EU trade, and consultationNumber is null, so check the customer in VIES again later. proof is consultation_number only when VIES issued a consultation number. A number with the wrong format or check digit for its country is answered at once with source local_check and isValid false, without calling VIES. Current VIES availability by member state: GET /api/v1/vat/vies-status.
Need the consultation number even when VIES is down? Use POST /api/v1/vat/checks (or callbackUrl on /companies/verify). When VIES answers you get 200 with the consultation number. When it does not, you get 202 with the provisional answer from the register, and we keep retrying (densely the same day, up to 72 h). The result arrives by webhook vat.check.completed or vat.check.failed, so you need no cron of your own. Store consultationNumber, checkedAt and requester with the order. The requester is your VAT ID: send it in the request, or fill it in once in your billing details (entyrix.com/account, Billing) and we use it by default. A platform with several shops sends each shop's VAT ID as requester. Only your own VAT ID, or that of a shop you demonstrably act for, may be the requester, and VIES answers must not be passed on to third parties (Terms, clause 5). The webhook secret is created with your first check that has callbackUrl and returned once in its response as meta.webhookSecret; you can rotate it in the account. To test the integration without waiting for a real outage, use vatNumber 100 (valid), 200 (invalid) or 300 (VIES down: 202, then a webhook within about 3 minutes) with any EU country; these never call VIES and the response has test: true. Missed a webhook? GET /api/v1/vat/checks lists your checks from the last 90 days (filter externalRef, from, to, status; format=csv for an export). Store with the order: consultationNumber, checkedAt, requester and the name and address VIES returned. The consultation number proves you checked the VAT ID that day; it is not a guarantee of the exemption, and a provisional answer from a register is not proof.
Unreliable VAT payer, insolvency, sanctions
One call returns what our registers know about the company's risk.
curl -H "Authorization: Bearer $ENTYRIX_API_KEY" \ "https://entyrix.com/api/v1/companies/27082440/compliance?country=CZ"
// trimmed
{
"data": {
"overall": "STANDARD",
"flagsCount": { "critical": 0, "high": 0, "medium": 0, "low": 0 },
"signals": {
"sanctions": { "isSanctioned": false, "isDebarred": false },
"insolvency": { "inBankruptcy": false, "inLiquidation": false, "inRestructuring": false },
"tax": {
"reliability": "reliable",
"isVatPayer": true,
"viesValid": true,
"viesValidatedAt": "2026-09-08T03:04:19.325Z"
}
}
}
}
| Country | reliability values | Bad value |
|---|---|---|
| CZ | reliable, unreliable | unreliable (nespolehlivý plátce DPH) |
| SK | vysoko spoľahlivý, spoľahlivý, menej spoľahlivý | menej spoľahlivý (Financial Administration index) |
viesValid in this response is a stored value from our periodic VIES checks and can be weeks old (look at viesValidatedAt). For an order, use the live check from step 3.
overall is INSUFFICIENT_DATA when we found nothing but do not hold an insolvency or sanctions register for that country. It does not mean the company is fine.
Shortcut: one call
For a finished order, POST /companies/verify does steps 2 to 4 at once: a live VIES check of the VAT number, and the name, address and VAT number from the order compared with the registry. Send country plus ico or vatId; name, address and requester are optional. Show the verdict as an icon on the order.
curl -X POST -H "Authorization: Bearer $ENTYRIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"country":"CZ","ico":"27082440","vatId":"CZ27082440","name":"ALZA.CZ, a. s.","address":"Jankovcova 53, 170 00 Praha"}' \
"https://entyrix.com/api/v1/companies/verify"
// trimmed
{
"data": {
"verdict": "verified",
"reasons": [],
"company": { "ico": "27082440", "name": "Alza.cz a.s.", "status": "active", "vatId": "CZ27082440" },
"registry": { "found": true },
"vat": { "state": "valid", "checkedAt": "2026-10-30T14:05:21.851Z", "consultationNumber": null },
"match": { "name": "match", "address": "match", "vatId": "match" }
}
}
| Verdict | When | What to do |
|---|---|---|
verified | VAT number valid in VIES, data match the registry | Mark the customer as verified. For a supply to another EU country you may invoice without VAT (reverse charge). ADDRESS_PARTIAL (same street and postal code, different or missing house number) and NAME_CLOSE (name differs only slightly) in reasons are information only; if you want to be stricter, treat them as review. VAT_PROVISIONAL_REGISTRY means VIES was down and the national register confirmed the domestic VAT registration (vat.source national_registry, vat.provisional true, vat.proof none, no consultation number). That is not proof of validity for intra-EU trade: check in VIES again later, or send callback_url and we deliver the consultation number by webhook once VIES answers. |
review | Name, address or VAT number differ, an unreliable VAT payer, or the company is not in our copy of the register yet (newly founded) | Have a person look at the order. |
unverified | VIES or the member state is down, no VAT number, or the name/address could not be compared (a country whose register we do not hold, e.g. DE: NAME_NOT_CHECKED, ADDRESS_NOT_CHECKED) | Try again later. With NAME_NOT_CHECKED or ADDRESS_NOT_CHECKED only the VAT number is confirmed, a retry will not change that. |
invalid | VAT number invalid, or the company was dissolved | Do not invoice a cross-border supply without VAT; ask the customer. |
reasons lists stable codes such as VAT_INVALID, NAME_MISMATCH or VIES_UNAVAILABLE; map them to your own texts. For a sole trader we do not compare with the registry without the natural-person addendum: registry.reason is natural_person and only the VAT number is checked.
<?php
/** One call: VIES + registry match. Returns verified | review | unverified | invalid. */
function entyrix_verify_customer(string $apiKey, array $order, ?string $ownVatId = null): array
{
$payload = [
'country' => $order['country'], // ISO-2, e.g. CZ
'ico' => $order['ico'] ?? null,
'vatId' => $order['vat_id'] ?? null, // with the country prefix, e.g. CZ27082440
'name' => $order['company'] ?? null,
'address' => $order['address'] ?? null,
];
if ($ownVatId !== null) {
$payload['requester'] = $ownVatId; // VIES then issues a consultation number
}
$ch = curl_init('https://entyrix.com/api/v1/companies/verify');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(array_filter($payload, fn ($v) => $v !== null)),
CURLOPT_CONNECTTIMEOUT => 3,
CURLOPT_TIMEOUT => 15, // VIES itself can take several seconds
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
'Accept: application/json',
],
]);
$raw = curl_exec($ch);
$status = (int) curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($raw === false || $status !== 200) {
// Bad input (400) or our API is unreachable. Never show this as verified.
return ['verdict' => 'unverified', 'reasons' => ['REQUEST_FAILED']];
}
$d = json_decode($raw, true)['data'];
return [
'verdict' => $d['verdict'], // the icon on the order
'reasons' => $d['reasons'], // stable codes, map them to your own texts
'checked_at' => $d['vat']['checkedAt'],
'consultation' => $d['vat']['consultationNumber'],
];
}/** One call: VIES + registry match. Returns verified | review | unverified | invalid. */
export async function verifyCustomer(apiKey, order, ownVatId = null) {
const payload = {
country: order.country, // ISO-2, e.g. CZ
ico: order.ico,
vatId: order.vatId, // with the country prefix, e.g. CZ27082440
name: order.company,
address: order.address,
...(ownVatId ? { requester: ownVatId } : {}), // VIES then issues a consultation number
};
let res;
try {
res = await fetch("https://entyrix.com/api/v1/companies/verify", {
method: "POST",
headers: {
Authorization: "Bearer " + apiKey,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify(payload),
signal: AbortSignal.timeout(15000), // VIES itself can take several seconds
});
} catch {
return { verdict: "unverified", reasons: ["REQUEST_FAILED"] };
}
if (res.status !== 200) return { verdict: "unverified", reasons: ["REQUEST_FAILED"] };
const { data } = await res.json();
return {
verdict: data.verdict, // the icon on the order
reasons: data.reasons, // stable codes, map them to your own texts
checkedAt: data.vat.checkedAt,
consultation: data.vat.consultationNumber,
};
}Payment terms
If you invoice on terms, one call tells you to whom. Check hardStop first, then score: hardStop means refuse whatever the number.
curl -H "Authorization: Bearer $ENTYRIX_API_KEY" \ "https://entyrix.com/api/v1/companies/36620319/credit-score?country=SK"
// SLOVNAFT, a.s. - hardStop is null, invoice on terms
{ "data": { "score": 100, "grade": "A+", "baseline": 70, "hardStop": null, "warnings": [] } }
// a company in bankruptcy - trimmed, the real factors list is longer
{
"data": {
"ico": "36620319", "companyName": "Potraviny Kačka, a.s. „v konkurze“",
"score": 0, "grade": "F", "baseline": 70,
"hardStop": "bankruptcy",
"factors": [
{ "name": "bankruptcy", "delta": -80, "note": "Konkurzné konanie" },
{ "name": "socialInsuranceDebt", "delta": -20, "note": "SocPoist dlh €35,283" },
{ "name": "negativeEquity", "delta": -25, "note": "Záporné vlastné imanie €17,451,133" }
],
"warnings": ["KRITICKÉ: firma v konkurze", "Záporné vlastné imanie (technický bankrot)"]
}
}
hardStop is one of bankruptcy, liquidation, sanctions hit or debarment. A starting point we use in the snippets: hardStop means refuse or prepayment only, score under 40 means prepayment, above that your usual terms. Set the threshold by how many unpaid invoices you can carry. factors lists what moved the score, so you can explain a refusal.
Watching after the order
A check tells you about the day of the order. With a subscription you hear about the customer's bankruptcy months later.
curl -X POST -H "Authorization: Bearer $ENTYRIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ico":"27082440","country_code":"CZ","webhook_url":"https://shop.example/entyrix","tier":"free"}' \
"https://entyrix.com/api/v1/monitoring/subscriptions"
// 201 Created - webhookSecret is shown ONCE. Store it now.
{
"data": {
"id": 4,
"ico": "31322832",
"webhookUrl": "https://shop.example/entyrix",
"webhookSecret": "84d679a7…963de4d",
"webhookVersion": 2,
"digestFrequency": "immediate",
"tier": "free",
"createdAt": "2026-08-30T16:11:01.440Z"
}
}
Subscriptions are per company and deliver every event type the tier allows. There is no per-type filter and no events[] or company_filter field in the request body. The free tier delivers 8 of the 35 types.
Coverage differs by country: 5 types fire wherever we hold a registry row, 7 only for Slovakia and the Czech Republic, and 2 have no production data yet. The list of types is in the OpenAPI spec under MonitoringEventType; per-country coverage on request.
What lands on your endpoint
POST /entyrix HTTP/1.1 Content-Type: application/json User-Agent: Entyrix-Webhook/1.0 X-Entyrix-Event-ID: 3f1c… ← idempotency key, dedupe on this X-Entyrix-Timestamp: 1788106367000 ← decimal ms since epoch X-Entyrix-Webhook-Version: 2 X-Entyrix-Signature: sha256=<hex> ← HMAC over "<timestamp>.<raw body>"
The signature covers the timestamp and the raw body joined by a dot, so read the body before any JSON middleware touches it. Reject anything older than 5 minutes and compare in constant time. We make up to 3 attempts (0 s, 5 s, 30 s) when your endpoint answers 408, 425, 429 or 5xx, so deduplicate on X-Entyrix-Event-ID.
<?php
/**
* Entyrix webhook receiver (signature v2).
* Read the RAW body - a parsed/re-encoded body will not match the signature.
*/
$rawBody = file_get_contents('php://input');
$timestamp = $_SERVER['HTTP_X_ENTYRIX_TIMESTAMP'] ?? '';
$signature = $_SERVER['HTTP_X_ENTYRIX_SIGNATURE'] ?? '';
$secret = getenv('ENTYRIX_WEBHOOK_SECRET'); // shown ONCE, at subscribe time
function entyrix_verify_webhook(
string $rawBody,
string $timestamp,
string $signature,
string $secret
): bool {
if (!preg_match('/^\d+$/', $timestamp)) {
return false;
}
$nowMs = (int) round(microtime(true) * 1000);
if (abs($nowMs - (int) $timestamp) > 300000) {
return false; // outside the 5-minute replay window
}
$expected = 'sha256=' . hash_hmac('sha256', $timestamp . '.' . $rawBody, $secret);
return hash_equals($expected, $signature); // constant-time
}
if (!entyrix_verify_webhook($rawBody, $timestamp, $signature, $secret)) {
http_response_code(401);
exit;
}
$event = json_decode($rawBody, true);
// Deduplicate on $event['eventId'] - a retry re-sends the same id.
// $event['eventType'] is the stable code; never branch on the Slovak summary.
if ($event['eventType'] === 'bankruptcy_change') {
// e.g. flip the customer to prepay-only
}
http_response_code(200); // 408, 425, 429 and 5xx get another attempt; other codes do notimport { createHmac, timingSafeEqual } from "node:crypto";
/** Verify an Entyrix webhook (signature v2). */
export function verifyWebhook(rawBody, timestamp, signature, secret) {
if (!/^\d+$/.test(timestamp)) return false;
if (Math.abs(Date.now() - Number(timestamp)) > 300000) return false; // 5-min replay window
const expected =
"sha256=" + createHmac("sha256", secret).update(timestamp + "." + rawBody).digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(signature);
return a.length === b.length && timingSafeEqual(a, b); // constant-time
}
// Express - mount with a RAW body parser, not express.json():
// app.post("/entyrix", express.raw({ type: "application/json" }), handler)
export function handler(req, res) {
const rawBody = req.body.toString("utf8");
const ok = verifyWebhook(
rawBody,
req.get("X-Entyrix-Timestamp") ?? "",
req.get("X-Entyrix-Signature") ?? "",
process.env.ENTYRIX_WEBHOOK_SECRET
);
if (!ok) return res.sendStatus(401);
const event = JSON.parse(rawBody);
// Deduplicate on event.eventId - a retry re-sends the same id.
// event.eventType is the stable code; never branch on the Slovak summary.
if (event.eventType === "bankruptcy_change") {
// e.g. flip the customer to prepay-only
}
res.sendStatus(200); // 408, 425, 429 and 5xx get another attempt; other codes do not
}Errors and limits
Every error carries meta.request_id. Quote it when you ask us about a call.
| Status | Meaning | What your code should do |
|---|---|---|
| 400 | INVALID_COUNTRY, INVALID_ICO: bad input | Fix the request, do not retry. |
| 401 | UNAUTHORIZED, KEY_INACTIVE: missing, unknown or long-unused key | Alert someone. Never retry in a loop. |
| 403 | FORBIDDEN: key disabled or expired | Alert someone. |
| 404 | Company not found or a sole trader behind the gate. Codes differ per route (NOT_FOUND, COMPANY_NOT_FOUND, FO_GATED_NO_DPA). | Branch on the HTTP status, not on error.code. Fall back to manual entry. |
| 429 | RATE_LIMITED: too many per minute; QUOTA_EXCEEDED: monthly quota used up | Per minute: wait (Retry-After if present, else 1 s) and retry once. Monthly: retrying will not help until the next month or a higher plan. |
| 503 | VIES_UPSTREAM_ERROR: VIES did not answer | Show the VAT number as unverified; retry after the Retry-After seconds. |
| 5xx | Temporary failure. | Retry once after a pause, then send the registration to manual review. |
Two limits per minute, one per month
Two independent layers. Per key: the plan limit in a fixed 60-second window (Free 120 per minute; other plans on the pricing page). Shared: ~600 requests per minute per IP for calls without a key, and per key ~600 or the key's own plan limit when it is higher; only this layer sends Retry-After. Both send X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. That is why the snippets wait one second when Retry-After is missing.
A registration form will not get near the per-minute limits. Re-checking your whole customer base will: split it into batches, or on Pro use POST /companies/bulk with up to 100 IČOs per call.
Client to copy
Steps 1 to 5 with retries and error handling. Set ENTYRIX_API_KEY in your server environment, not in a theme file and not in a JavaScript bundle.
<?php
/**
* Entyrix - checks a business customer from your server.
* Runs on your server ONLY. The sk_ key must never reach the browser.
*/
final class EntyrixClient
{
private const BASE = 'https://entyrix.com/api/v1';
public function __construct(private string $apiKey) {}
/** One retry on 429/5xx. Retry-After is not always sent, so default to 1 s. */
private function call(string $path, array $query = []): array
{
$url = self::BASE . $path . ($query ? '?' . http_build_query($query) : '');
for ($attempt = 0; $attempt < 2; $attempt++) {
$retryAfter = 1;
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 3,
CURLOPT_TIMEOUT => 15, // VIES itself can take several seconds
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $this->apiKey,
'Accept: application/json',
],
CURLOPT_HEADERFUNCTION => function ($ch, $header) use (&$retryAfter) {
if (stripos($header, 'retry-after:') === 0) {
$retryAfter = (int) trim(substr($header, 12));
}
return strlen($header);
},
]);
$raw = curl_exec($ch);
$status = (int) curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$err = curl_error($ch);
curl_close($ch);
if ($raw === false) {
return ['status' => 0, 'body' => null, 'error' => $err];
}
if (($status === 429 || $status >= 500) && $attempt === 0) {
sleep(max(1, min($retryAfter, 5)));
continue;
}
return ['status' => $status, 'body' => json_decode($raw, true), 'error' => null];
}
return ['status' => 0, 'body' => null, 'error' => 'unreachable'];
}
/** Step 1 - IČO / name autocomplete. */
public function suggest(string $q, string $country, int $limit = 8): array
{
if (mb_strlen(trim($q)) < 2) {
return [];
}
$r = $this->call('/companies/autocomplete', ['q' => $q, 'country' => $country, 'limit' => $limit]);
return $r['status'] === 200 ? ($r['body']['data'] ?? []) : [];
}
/** Step 2 - billing details from the registry. null = fall back to manual entry. */
public function profile(string $ico, string $country): ?array
{
$r = $this->call('/companies/' . rawurlencode($ico), ['country' => $country]);
if ($r['status'] !== 200) {
return null; // also sole traders: 404 FO_GATED_NO_DPA
}
$c = $r['body']['data'];
return [
'name' => $c['name'],
'address' => $c['address'], // one line, always has the house number
'street' => $c['street'],
'number' => $c['buildingNumber'], // can be null - then take 'address'
'postcode' => $c['postalCode'],
'city' => $c['municipality'],
'country' => $c['country'],
'vat_id' => $c['vatId'], // null = not a VAT payer we know of
'status' => $c['status'],
];
}
/**
* Step 3 - live VIES check. Returns valid | invalid | unverified.
* $ownVatId = your shop's VAT number; VIES then issues a consultation number.
*/
public function checkVat(string $vatId, ?string $ownVatId = null): array
{
$query = ['country' => substr($vatId, 0, 2), 'vatin' => substr($vatId, 2)];
if ($ownVatId !== null) {
$query['requester'] = $ownVatId;
}
$r = $this->call('/vat/validate', $query);
if ($r['status'] !== 200) {
// VIES or a member state is down. Never show this as valid or invalid.
return ['state' => 'unverified'];
}
$d = $r['body']['data'];
return [
'state' => $d['isValid'] ? 'valid' : 'invalid',
'vies_name' => $d['name'],
'checked_at' => $d['checkedAt'],
'consultation' => $d['consultationNumber'], // null without $ownVatId
];
}
/** Step 4 - risk summary: unreliable VAT payer, insolvency, sanctions. */
public function risk(string $ico, string $country): ?array
{
$r = $this->call('/companies/' . rawurlencode($ico) . '/compliance', ['country' => $country]);
if ($r['status'] !== 200) {
return null;
}
$s = $r['body']['data']['signals'];
$reliability = $s['tax']['reliability'] ?? null;
return [
'overall' => $r['body']['data']['overall'],
'unreliable_payer' => in_array($reliability, ['unreliable', 'menej spoľahlivý'], true),
'in_bankruptcy' => $s['insolvency']['inBankruptcy'] ?? null,
'in_liquidation' => $s['insolvency']['inLiquidation'] ?? null,
'sanctioned' => $s['sanctions']['isSanctioned'] ?? null,
];
}
/** Step 5 - payment terms. Fails to manual review, never to approval. */
public function creditGate(string $ico, string $country): array
{
$r = $this->call('/companies/' . rawurlencode($ico) . '/credit-score', ['country' => $country]);
if ($r['status'] !== 200) {
return ['decision' => 'review', 'reason' => 'score_unavailable'];
}
$d = $r['body']['data'];
if (!empty($d['hardStop'])) {
return ['decision' => 'block', 'reason' => $d['hardStop'], 'grade' => $d['grade']];
}
if ((int) $d['score'] < 40) {
return ['decision' => 'prepay', 'reason' => 'low_score', 'grade' => $d['grade']];
}
return ['decision' => 'invoice', 'grade' => $d['grade'], 'score' => $d['score']];
}
}/**
* Entyrix - checks a business customer from your server (Node 18+).
* Runs on your server ONLY. The sk_ key must never reach the browser.
*/
const BASE = "https://entyrix.com/api/v1";
export class EntyrixClient {
constructor(apiKey) {
this.apiKey = apiKey;
}
/** One retry on 429/5xx. Retry-After is not always sent, so default to 1 s. */
async call(path, query = {}) {
const url = new URL(BASE + path);
for (const [k, v] of Object.entries(query)) url.searchParams.set(k, String(v));
for (let attempt = 0; attempt < 2; attempt++) {
let res;
try {
res = await fetch(url, {
headers: { Authorization: "Bearer " + this.apiKey, Accept: "application/json" },
signal: AbortSignal.timeout(15000), // VIES itself can take several seconds
});
} catch (err) {
return { status: 0, body: null, error: String(err) };
}
if ((res.status === 429 || res.status >= 500) && attempt === 0) {
const wait = Number(res.headers.get("retry-after") || 1);
await new Promise((r) => setTimeout(r, Math.min(Math.max(wait, 1), 5) * 1000));
continue;
}
return { status: res.status, body: await res.json().catch(() => null), error: null };
}
return { status: 0, body: null, error: "unreachable" };
}
/** Step 1 - IČO / name autocomplete. */
async suggest(q, country, limit = 8) {
if (q.trim().length < 2) return [];
const r = await this.call("/companies/autocomplete", { q, country, limit });
return r.status === 200 ? (r.body?.data ?? []) : [];
}
/** Step 2 - billing details from the registry. null = fall back to manual entry. */
async profile(ico, country) {
const r = await this.call("/companies/" + encodeURIComponent(ico), { country });
if (r.status !== 200) return null; // also sole traders: 404 FO_GATED_NO_DPA
const c = r.body.data;
return {
name: c.name,
address: c.address, // one line, always has the house number
street: c.street,
number: c.buildingNumber, // can be null - then take address
postcode: c.postalCode,
city: c.municipality,
country: c.country,
vatId: c.vatId, // null = not a VAT payer we know of
status: c.status,
};
}
/**
* Step 3 - live VIES check. Returns valid | invalid | unverified.
* ownVatId = your shop's VAT number; VIES then issues a consultation number.
*/
async checkVat(vatId, ownVatId = null) {
const query = { country: vatId.slice(0, 2), vatin: vatId.slice(2) };
if (ownVatId) query.requester = ownVatId;
const r = await this.call("/vat/validate", query);
// VIES or a member state is down. Never show this as valid or invalid.
if (r.status !== 200) return { state: "unverified" };
const d = r.body.data;
return {
state: d.isValid ? "valid" : "invalid",
viesName: d.name,
checkedAt: d.checkedAt,
consultation: d.consultationNumber, // null without ownVatId
};
}
/** Step 4 - risk summary: unreliable VAT payer, insolvency, sanctions. */
async risk(ico, country) {
const r = await this.call("/companies/" + encodeURIComponent(ico) + "/compliance", { country });
if (r.status !== 200) return null;
const s = r.body.data.signals;
return {
overall: r.body.data.overall,
unreliablePayer: ["unreliable", "menej spoľahlivý"].includes(s.tax?.reliability),
inBankruptcy: s.insolvency?.inBankruptcy ?? null,
inLiquidation: s.insolvency?.inLiquidation ?? null,
sanctioned: s.sanctions?.isSanctioned ?? null,
};
}
/** Step 5 - payment terms. Fails to manual review, never to approval. */
async creditGate(ico, country) {
const r = await this.call("/companies/" + encodeURIComponent(ico) + "/credit-score", {
country,
});
if (r.status !== 200) return { decision: "review", reason: "score_unavailable" };
const d = r.body.data;
if (d.hardStop) return { decision: "block", reason: d.hardStop, grade: d.grade };
if (d.score < 40) return { decision: "prepay", reason: "low_score", grade: d.grade };
return { decision: "invoice", grade: d.grade, score: d.score };
}
}We ran both files against production on 30 October 2026 (SLOVNAFT, Alza, an invalid CZ VAT number and a company in bankruptcy) and they returned the same results.
Where to call it in a shop
Autocomplete and profile() from an AJAX endpoint of your own; checkVat() and risk() after the order or registration is submitted, and store the result with it so the order list can show it. In PrestaShop, actionValidateCustomerAddressForm or your registration hook is the place; in Symfony, a listener on the order or a Messenger message keeps the slow VIES call out of the request. Keep the key in an environment variable: a key in config/settings.inc.php or a .env committed to the shop repository leaks easily.
Widgets in the browser
If you want to show a credit, financials or relations widget directly on a page, mint a domain-pinned token on your server and give the page only that.
# Server-side: mint a token pinned to your shop's host.
curl -X POST -H "Authorization: Bearer $ENTYRIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain":"shop.example","widget_types":["credit"],"ttl_seconds":2592000}' \
"https://entyrix.com/api/v1/widget-token"
# Then embed the returned token in your page:
# <script src="https://entyrix.com/api/v1/widget.js"
# data-widget="credit" data-ico="31322832" data-country="SK"
# data-token="..."></script>
| Mechanism | Pinned to | What it protects |
|---|---|---|
sk_ API key | Nothing. The key has no origin, domain or referrer field. | Only secrecy. Keep it on the server. |
| CORS list | Fixed Entyrix and NISMap hosts, the same for every key. | Your domain cannot be added per key, so a browser call from your shop gets no Access-Control-Allow-Origin and the browser drops the answer. This holds for /public/* too. |
/widget-token | One exact host, signed into the token. | Widget data only. Checked against Origin, then Referer; a request with neither is refused. |
Widgets cover credit, financials and relations, not autocomplete, company detail or monitoring. The token lasts 30 days by default and at most 90, and the host must match exactly: a token for shop.example is refused on www.shop.example.
Need a key?
Sign in and you get a Free key right away; the live VIES check works on it too. Coverage differs by country, so write to [email protected] which markets you sell into and we will tell you what works where.