SFOLN

Demos / EU VAT Number Validator (VIES)

Apply the EU reverse charge at checkout from a VAT ID

A software company in the Netherlands sells subscriptions to businesses across the EU. A buyer with a valid VAT ID in another member state is invoiced without VAT under the reverse charge, but only if the seller can show the ID was valid at the time of sale. Checking by hand after the order means refunds, corrected invoices and no proof. Here the checkout checks the ID when it is entered: a valid ID fills the billing details and removes the VAT, an invalid one keeps VAT on, and a registry outage is treated as "not verified yet" and not as a rejection.

Workflow

Where the API sits

  1. Trigger

    Buyer enters a VAT ID

    The billing form sends the ID to the shop backend as soon as the field is left.

  2. API call

    Check it in VIES

    One call with vatNumbers and the seller's requesterVatNumber. Malformed IDs are rejected before any lookup; outages come back as error, never as invalid.

    sfoln/vat-number-validator

  3. Your logic

    Choose the VAT treatment

    valid: true in another member state: 0% reverse charge. valid: false or no answer: VAT stays on.

  4. Result

    Order and invoice

    Billing details filled from the registry, the consultation number stored with the order and printed on the invoice.

Wired into the checkout backend: when the VAT ID field loses focus the server calls the API synchronously with the seller's own number as requesterVatNumber and returns the result to the form. A scheduled run rechecks IDs that could not be verified, and can revalidate the whole customer base every quarter.

Result

The checkout decides the VAT treatment

Valid VAT ID

CheckoutBilling detailschecked in 1 s
VAT IDATU61234567Valid in VIES · Austria
Company nameLindwurm Analytik GmbHFilled from the registry
Billing addressBahnhofstrasse 14, AT-9020 KlagenfurtFilled from the registry
Contact e-maileinkauf@lindwurm-analytik.example

The buyer typed the ID with a space; the response returns it normalised. Name and address come from the registry, so the invoice matches the registration.

Order summary

Scheduling suite, Team plan, 12 months
EUR 1,080.00
Onboarding session, remote
EUR 220.00
Net
EUR 1,300.00
VAT 0% · reverse charge
EUR 0.00
Total to pay
EUR 1,300.00
Pay by cardPay by bank transfer
Reverse charge appliedConsultation WAPIAAAAbK3fQ7Lm stored with the order

Invalid VAT ID

CheckoutBilling detailschecked in 1 s
VAT IDIT01234567890This VAT ID is not registered in VIES. Correct it, or continue with VAT.
Company nameOfficina Baldessari S.r.l.Typed by the buyer
Billing addressVia dei Tigli 8, 38122 TrentoTyped by the buyer
Contact e-mailacquisti@baldessari.example

VIES answered valid: false, a definitive answer. The order can still be placed, with VAT.

Order summary

Scheduling suite, Team plan, 12 months
EUR 1,080.00
Onboarding session, remote
EUR 220.00
Net
EUR 1,300.00
VAT 22% · Italy
EUR 286.00
Total to pay
EUR 1,586.00
Pay by cardPay by bank transfer
VAT kept onNo reverse charge without a valid VAT ID

Registry unavailable

CheckoutBilling detailsregistry did not answer
VAT IDDE298765432We could not verify this ID right now. VAT is charged and refunded once the ID is confirmed.
Company nameRotbuche Werkzeugbau GmbHTyped by the buyer
Billing addressGerberstrasse 21, 73728 EsslingenTyped by the buyer
Contact e-maileinkauf@rotbuche-werkzeugbau.example

The response says vies_ms_unavailable instead of "invalid", so the shop does not reject a real business. A recheck is queued for the next hour.

Order summary

Scheduling suite, Team plan, 12 months
EUR 1,080.00
Onboarding session, remote
EUR 220.00
Net
EUR 1,300.00
VAT 19% · Germany
EUR 247.00
Total to pay
EUR 1,547.00
Pay by cardPay by bank transfer
Recheck queuedThis check was not charged
BillingInvoice for order 04417sent as PDF

Invoice KP-2026-04417

Kestrel Planning Software B.V. · Utrecht · VAT ID NL861234567B01 · issued 2026-11-10

Bill to
Lindwurm Analytik GmbH
Address
Bahnhofstrasse 14, AT-9020 Klagenfurt
Customer VAT ID
ATU61234567
VAT ID verified
VIES consultation WAPIAAAAbK3fQ7Lm on 2026-11-10 09:41 UTC
DescriptionNet EURVATAmount EUR
Scheduling suite, Team plan, 12 months1,080.000%1,080.00
Onboarding session, remote220.000%220.00
Total1,300.000.001,300.00

Reverse charge: VAT to be accounted for by the recipient (Article 196 of Directive 2006/112/EC).

Shop adminVAT ID checks3 today
VAT ID checks · Tue 10 Nov
Time (UTC)VAT ID enteredRegistry answerRegistered nameConsultation no.Checkout result
09:41ATU 61234567validAustriaLindwurm Analytik GmbHWAPIAAAAbK3fQ7LmReverse charge, 0% VAT
10:02IT01234567890not validItalynonenoneVAT 22% charged
10:26DE298765432no answerGermanynonenoneVAT 19% charged, recheck queued
Three checkouts shown as one sample run; the live checkout sends one ID per call. Two definitive answers were charged, the outage was not.

Highlighted values are read from the API response. The data is a sample in the API's real output shape; names and figures are illustrative.

Call

The call behind it

One request with this input produces the 3 records the screen above is drawn from. Prices are the ones on the API page; records that fail or come back empty are not charged.

Input · POST /v2/actors/sfoln~vat-number-validator/run-sync-get-dataset-items
{
  "vatNumbers": [
    "ATU 61234567",
    "IT01234567890",
    "DE298765432"
  ],
  "requesterVatNumber": "NL861234567B01"
}
Response · record 1 of 3 · sample data
{
  "input": "ATU 61234567",
  "status": "ok",
  "charged": true,
  "chargedEvent": "vat-check",
  "source": "vies",
  "fetchedAt": "2026-11-10T09:41:17.204Z",
  "vatNumber": "ATU61234567",
  "countryCode": "AT",
  "countryName": "Austria",
  "number": "U61234567",
  "formatValid": true,
  "valid": true,
  "name": "Lindwurm Analytik GmbH",
  "address": "Bahnhofstrasse 14, AT-9020 Klagenfurt",
  "requestDate": "2026-11-10T09:41:17.512Z",
  "consultationNumber": "WAPIAAAAbK3fQ7Lm",
  "requesterVatNumber": "NL861234567B01"
}
Charged eventCountPriceTotal
VAT number check
vat-check
2$0.002$0.004
This run$0.004

Fields

Which output fields do the work

Output fieldUsed for
validDecides the VAT treatment: true for a buyer in another member state removes the VAT, false keeps it on.
name addressFill the billing form and the invoice, where the member state shares them (Germany, for example, does not).
vatNumber countryCode countryNameThe normalised ID printed on the invoice; the country selects the VAT rate when the ID is not valid.
consultationNumber requestDate requesterVatNumberStored with the order and printed on the invoice as evidence of when the ID was verified and by whom.
status error formatValidAn outage (status: "error") queues a recheck; a malformed ID (skipped_invalid) is shown as a typing error. Neither is charged.

All output fields are listed on the API page.

Build

Build it

The endpoint behind the VAT ID field: one synchronous call, then a VAT decision the form can render.

Node.js · checkout endpoint
app.post('/checkout/vat-id', async (req, res) => {
  const run = await fetch('https://api.apify.com/v2/actors/sfoln~vat-number-validator/run-sync-get-dataset-items', {
    method: 'POST',
    headers: { Authorization: `Bearer ${process.env.APIFY_TOKEN}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ vatNumbers: [req.body.vatId], requesterVatNumber: SELLER_VAT_ID }),
  });
  const [check] = await run.json();

  if (check.status === 'skipped_invalid') return res.json({ state: 'typo', message: check.error.message });
  if (check.status !== 'ok') {
    await recheckQueue.add(req.body.orderId, check.vatNumber);
    return res.json({ state: 'unverified', vatRate: rateFor(check.countryCode) });
  }
  const reverseCharge = check.valid && check.countryCode !== SELLER_COUNTRY;
  await orders.update(req.body.orderId, {
    vatId: check.vatNumber, vatRate: reverseCharge ? 0 : rateFor(check.countryCode),
    viesConsultation: check.consultationNumber, viesCheckedAt: check.requestDate,
  });
  res.json({ state: check.valid ? 'valid' : 'invalid', name: check.name, address: check.address, reverseCharge });
});
  • Set requesterVatNumber to your own EU VAT number to receive a consultation number with each check.
  • Which supplies qualify for the reverse charge depends on what you sell and where; the API confirms the ID, the tax rule is yours to apply.

Authentication, the MCP endpoint and the asynchronous variant are on the API page.

More

Other things teams build with it

  • Supplier onboarding that rejects invoices from unregistered VAT IDs
  • A quarterly revalidation of every customer VAT ID in the CRM
  • Marketplace seller sign-up that prefills the legal name from the registry
  • An accounts-payable agent that checks the VAT ID on incoming invoices

Related demos

All demos · EU VAT Number Validator (VIES): prices, input and output · /actors/vat-number-validator.json carries this demo as demo