Online EU VAT validation against the official VIES service
(https://ec.europa.eu/taxation_customs/vies/). This namespace is the one part
of the library that does network I/O. It stays separate, so that
stdnum.core stays pure and keeps few dependencies. check confirms that a
VAT number exists in the member-state registry, which a checksum cannot do.
It also returns the trader name and address if the member state gives them.
(require '[stdnum.vies :as vies])
(vies/check "DE136695976")
;=> {:valid? true, :country "DE", :vat-number "136695976", :name "...", ...}
Requires JDK 11+ (it uses java.net.http). On a network failure or a service
failure, check returns {:error <message>} and does not throw.
Online EU VAT validation against the official VIES service
(https://ec.europa.eu/taxation_customs/vies/). This namespace is the one part
of the library that does network I/O. It stays separate, so that
`stdnum.core` stays pure and keeps few dependencies. `check` confirms that a
VAT number *exists* in the member-state registry, which a checksum cannot do.
It also returns the trader name and address if the member state gives them.
(require '[stdnum.vies :as vies])
(vies/check "DE136695976")
;=> {:valid? true, :country "DE", :vat-number "136695976", :name "...", ...}
Requires JDK 11+ (it uses java.net.http). On a network failure or a service
failure, `check` returns `{:error <message>}` and does not throw.(check vat)(check country number)Look up a VAT number against the live EU VIES service. Accepts a full VAT id
with a country prefix ("DE136695976"), or an explicit country and number.
Returns {:valid? :country :vat-number :name :address :request-date :raw} on a
reply. Returns {:error <message>} on a network failure or a service failure.
This function does a network request and requires JDK 11+.
Look up a VAT number against the live EU VIES service. Accepts a full VAT id
with a country prefix ("DE136695976"), or an explicit `country` and `number`.
Returns `{:valid? :country :vat-number :name :address :request-date :raw}` on a
reply. Returns `{:error <message>}` on a network failure or a service failure.
This function does a network request and requires JDK 11+.(parse-response body)Pure: turn a VIES REST JSON response body into a result map. A successful reply
gives {:valid? :country :vat-number :name :address :request-date :raw}. A
member-state error (for example MS_UNAVAILABLE or MS_MAX_CONCURRENT_REQ)
gives {:error <code> :raw}: the validity is unknown, not false. This
function is public, so that you can test the parse without a network call.
Pure: turn a VIES REST JSON response body into a result map. A successful reply
gives `{:valid? :country :vat-number :name :address :request-date :raw}`. A
member-state error (for example `MS_UNAVAILABLE` or `MS_MAX_CONCURRENT_REQ`)
gives `{:error <code> :raw}`: the validity is unknown, not false. This
function is public, so that you can test the parse without a network call.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |