A 13-step request processing pipeline with 4-layer abuse protection, intelligent caching, circuit breaker pattern, and dual counter system for accurate billing.
App Proxy endpoints only. Limits to 5 requests/min per IP per shop. In-memory Map storage.
Plan-based limits: Free=10/min, Starter=30/min, Pro=60/min, Enterprise=300/min.
Regex pattern match against 28 country formats. Invalid format returns 200 response immediately. No counters are incremented.
Same VAT number submitted within 60 seconds returns cached result. No counters increment, no DB or VIES query.
Query vat_cache table for existing validation result. 24-hour TTL on cached entries.
If cache hit: increment monthly_validations++ and return cached result. VIES is never called. Quota is preserved.
Verify monthly_vies_calls < plan limit. Free=50, Starter=500, Pro=5000, Enterprise=unlimited.
If circuit is OPEN (5 consecutive VIES failures), skip VIES call and return format_only result.
HTTP XML (SOAP) request to EU VIES service. 10s timeout, exponential backoff retry (2s, 4s, 8s).
UPSERT VIES response into vat_cache table with current timestamp. 24h TTL begins.
monthly_vies_calls++ is incremented ONLY for real VIES API calls. Cache hits do not affect this counter.
monthly_validations++ incremented and validation result logged for analytics and dashboard reporting.
Final validation response returned to the client with status, company name, address, and validation metadata.
| Error Code | Retry? | Description |
|---|---|---|
INVALID_INPUT |
No | Valid VIES response indicating invalid VAT number |
GLOBAL_MAX_CONCURRENT_REQ |
Yes | VIES global rate limit reached |
MS_MAX_CONCURRENT_REQ |
Yes | Member state service is busy |
SERVICE_UNAVAILABLE |
Yes | VIES service temporarily unavailable |
MS_UNAVAILABLE |
Yes | Member state service is down |
TIMEOUT |
Yes | Request timed out waiting for response |
${shopDomain}:${ip}shopDomainshops.monthly_vies_calls${shopDomain}:${normalizedVat}TIMEOUTSERVICE_UNAVAILABLEMS_UNAVAILABLEGLOBAL_MAX_CONCURRENT_REQINVALID_INPUT — valid VIES response, service is healthyvat_cache for an existing result. If found and within 24h TTL, return the cached validation result immediately.