Tax Required
Reverse-charge B2B sales with a checked VAT number
For services sold to a business in another EU country, check the buyer's VAT number in VIES. Charge no VAT and print "Reverse charge" on the invoice.
How to do it
Ask for the VAT number at checkout. Check it with the European Commission's VIES service, through its REST API or your tax service. Send your own VAT number with the request to get a consultation number, and store it with the date. If VIES is down, charge VAT or hold the order, then check again. Sales to businesses in your own country still carry VAT.
Example
async function checkVatNumber(countryCode, vatNumber) {
const response = await fetch('https://ec.europa.eu/taxation_customs/vies/rest-api/check-vat-number', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ countryCode, vatNumber, requesterMemberStateCode: 'SE', requesterNumber: '556677889901' }),
signal: AbortSignal.timeout(10_000),
})
if (!response.ok) throw new Error(`VIES answered ${response.status}`)
const result = await response.json()
return { valid: result.valid, consultationNumber: result.requestIdentifier, checkedAt: new Date().toISOString() }
}
import requests
from datetime import datetime, timezone
def check_vat_number(country_code: str, vat_number: str) -> dict:
response = requests.post(
"https://ec.europa.eu/taxation_customs/vies/rest-api/check-vat-number",
json={"countryCode": country_code, "vatNumber": vat_number,
"requesterMemberStateCode": "SE", "requesterNumber": "556677889901"},
timeout=10,
)
response.raise_for_status()
result = response.json()
return {"valid": result["valid"], "consultation_number": result.get("requestIdentifier"),
"checked_at": datetime.now(timezone.utc).isoformat()}
How to check
A checkout test with an invalid VAT number charges VAT. A valid number from another EU country gives zero VAT, a stored consultation number and the reverse charge note on the invoice.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers payments playbook: https://agentwranglers.se/playbook/payments/tax/reverse-charge-vies.