<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mieldekien</title>
    <description>The latest articles on DEV Community by mieldekien (@mieldekien).</description>
    <link>https://dev.to/mieldekien</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3969252%2Fdf6249c3-6dbb-46ff-947b-a53378b03d66.png</url>
      <title>DEV Community: mieldekien</title>
      <link>https://dev.to/mieldekien</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mieldekien"/>
    <language>en</language>
    <item>
      <title>Belgian VAT validation in 5 lines (with company name lookup)</title>
      <dc:creator>mieldekien</dc:creator>
      <pubDate>Fri, 05 Jun 2026 06:14:53 +0000</pubDate>
      <link>https://dev.to/mieldekien/belgian-vat-validation-in-5-lines-with-company-name-lookuphttpslanding-vatvercelapp-1788</link>
      <guid>https://dev.to/mieldekien/belgian-vat-validation-in-5-lines-with-company-name-lookuphttpslanding-vatvercelapp-1788</guid>
      <description>&lt;p&gt;&lt;a href="https://rapidapi.com/mieldekien8660/api/belgian-vat-validator" rel="noopener noreferrer"&gt;&lt;/a&gt;If you've ever had to validate a Belgian VAT number in code, you know the dance:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Strip whitespace and the &lt;code&gt;BE&lt;/code&gt; prefix&lt;/li&gt;
&lt;li&gt;Run a modulo-97 checksum (because Belgium is fancy)&lt;/li&gt;
&lt;li&gt;Hit the VIES SOAP endpoint to confirm it actually exists&lt;/li&gt;
&lt;li&gt;Parse the XML response to get the company name (if VIES feels like sharing it that day)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's 80 lines of code, an XML parser, and a pile of error handling. For something that &lt;em&gt;should&lt;/em&gt; be a one-liner.&lt;/p&gt;

&lt;p&gt;I got tired of writing it. So I built a small API that does all of it in a single GET request.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 5-line version
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
js
const res = await fetch(
  "https://belgian-vat-validator.p.rapidapi.com/api/validate?number=BE0417497106",
  { headers: { "X-RapidAPI-Key": "YOUR_KEY",
               "X-RapidAPI-Host": "belgian-vat-validator.p.rapidapi.com" } }
);
const data = await res.json();
console.log(data.valid, data.vies.name);
// → true "NV Anheuser-Busch InBev"

That's it. Format check, modulo-97 checksum, VIES lookup, and company name — all in under 200ms.

What you get back

{
  "input": "BE0417497106",
  "number": "BE0417497106",
  "formatted": "BE 0417 497 106",
  "valid": true,
  "checks": {
    "format": true,
    "checksum": true,
    "vies": true
  },
  "vies": {
    "available": true,
    "isValid": true,
    "name": "NV Anheuser-Busch InBev",
    "address": "Brouwerijplein 1\n3000 Leuven"
  }
}

Two things I want to point out:

- checks is a per-stage breakdown. If a number fails, you can tell whether it's a typo, a checksum error, or whether VIES says it doesn't exist. Useful for showing users what went wrong.
- vies.name and vies.address are free. A lot of devs assume VIES blocks company info. It do is there and it's official.

Why not just call VIES directly?

You can. The catch:

1. VIES is SOAP. You'll need an XML library or fast-xml-parser and a wrapper.
2. VIES is unreliable. It goes down for hours at a time, especially around month-end when accountants hammer it.
3. VIES gives no format/checksum errors. A malformed number returns the same "invalid" as aou'll still need your own pre-validation.
4. You're hand-rolling the modulo-97. It's not hard, but it's easy to get wrong silently (off-by-one in the slicing, integer overflow on 8-digit prefix).

Wrap all that and you've written half a library before you've shipped anything.

When to use this (and when not to)

Use it if you're building:
- Invoice or quote generation that needs to validate customer VAT before saving
- B2B onboarding flows where typos cause downstream pain
- Internal tooling for sales / finance / accounting
- An MVP where "build it yourself later" is the right tradeoff

Don't use it if:
- You process &amp;gt;100k VAT lookups per day — at that volume, run your own VIES proxy.
- You need EU-wide coverage today (it's BE-only; NL/FR/DE are on the list).
- Your customers won't tolerate any external dependency for VAT checks (regulated industrie

Try it

There's a free tier (https://rapidapi.com/mieldekien8660/api/belgian-vat-validator) with 10 wire up an MVP without a credit card.

If you have feedback or want a country added, I read every message.

Built by miel1 (https://rapidapi.com/mieldekien8660) on RapidAPI (https://rapidapi.com).[]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>api</category>
    </item>
  </channel>
</rss>
