Modules:Magenx_VatValidation (checks, tax treatment, admin) and Magenx_VatValidationGraphQl (storefront API) · storefront flag features.vatValidation
Business buyers enter a VAT number at registration, in the address book and at checkout. The number is checked locally, then against the EU (VIES) or UK (HMRC) registry. The cart gets the matching VAT treatment before payment, and every order keeps the proof of the check.
Each treatment maps to a customer tax class. The cart keeps its customer group, so prices, catalog and cart price rules and tier prices never move at checkout. Only the tax does. Guests never get business prices.
Treatment
When
Domestic business
Valid number from your home country.
Intra-EU business (reverse charge)
Valid number from another member state, or Northern Ireland (XI).
Consumer
No number, invalid, or not checked.
Pending
The registry did not answer. Settled by the outage policy.
A timeout is never treated as “invalid”. Outage Policy decides:
Charge VAT (default): treat as a consumer.
Zero-rate: reverse charge provisionally. The order is checked again on a schedule. If the number turns out invalid, or never gets an answer, the order is flagged for review in the order grid and admin inbox. Order totals are never changed afterwards.
Refuse: the order can’t be placed until the registry answers.
The check runs again as the order is placed. If the treatment changed since the shopper saw the total, the order is refused.
Separately from checkout, a valid VAT number on the account can move the customer into a business customer group, which then owns their business prices everywhere:
Automatic: the customer is moved as soon as the number is valid.
Review: you get an admin inbox message and decide.
Removing the number, or finding it invalid, moves the customer back to their previous group. A group you set by hand is never changed. Numbers on addresses or at checkout never move an account.
The buyer chooses a country and types a VAT number in the registration, address or checkout form.
The storefront asks the API to check the number. The format check runs first; a failure answers at once with a specific message and no registry call.
If the format is right, a recent result for the same normalised number is reused; otherwise the registry is called.
The answer comes back with the result, the normalised number and, where disclosed, the registered name and address. The form shows it next to the field.
Treatment at checkout
The buyer sets the tax address with a VAT number.
The system validates the number (F1 steps 2–3) and decides the VAT treatment from the result, the number's country and the home country.
The cart is recalculated with the tax category of that treatment. Its customer segment, and so its prices and discounts, stay those of the account (or of guests). The cart reports the treatment, so the storefront shows "VAT reverse charged" or "VAT charged" before payment.
Recalculating the cart again, for any reason, reuses the stored result. Only a change of number or country triggers a new validation.
Removing the number, or changing the tax address to one without a number, returns the cart to the consumer treatment.
Registry unavailable at checkout
The registry times out or reports the member state's service as unavailable.
The result is unavailable and the treatment is pending.
The outage policy decides: charge VAT — the cart uses the consumer tax category and tells the buyer the number could not be checked right now. Zero-rate provisionally — the cart uses the intra-EU business tax category and the order is marked for a deferred re-check. Refuse — the order cannot be placed until a check succeeds; the buyer may remove the number to continue.
A later attempt (new address save, or an explicit re-check from the storefront) calls the registry again.
Order placement
At placement the cart's treatment and validation evidence are frozen onto the order.
An order is placed with the intra-EU business treatment only if its evidence shows a valid result, or the result was unavailable and the outage policy is zero-rate provisionally.
The order, invoice and refund documents show the buyer's VAT number and, for reverse charge, the reverse-charge mention.
Deferred re-check
On a schedule, the system re-checks every order placed with a pending treatment.
A valid answer completes the evidence on the order. Nothing else changes.
An invalid answer marks the order for review and alerts the merchant. The placed order's totals are not changed automatically.
An order still unavailable after the configured number of attempts is marked for review.
Registration with a VAT number
A new customer enters a VAT number on the storefront registration form (with its country, or with a country prefix).
The number is validated as in F1. With registration validation set to strict, an invalid number refuses registration with a message; with it set to warn, registration succeeds and the account stores the result.
An unavailable registry never refuses registration.
With a valid result and the assignment mode set to automatic, the account is created in the business segment. In review mode it is created in the default segment and the merchant is notified. With an unavailable result the account is created in the default segment; the number is checked again the next time it is saved.
Save an address with a VAT number
A signed-in customer saves an address with a VAT number.
The number is validated and the result stored on the address.
When that address is later used as the tax address, a result still inside the reuse period is used without a new registry call.
Change or remove the account VAT number
A signed-in customer changes or removes the VAT number in their account details.
A new number is validated as in F6; a valid one moves the account to the business segment as in F6 step 4.
When the number is removed or found invalid, an account the system moved to the business segment returns to the segment it had before. An account the merchant placed in a segment by hand is never moved by the system.
No order is placed with the intra-EU business treatment unless its evidence shows a valid result, or an unavailable result under the zero-rate-provisionally policy with a deferred re-check scheduled.
Evidence frozen on an order is never edited or deleted; later re-checks add to it.
A cart's treatment always matches the current tax address's number and country and its stored result. A changed number never keeps the previous number's treatment.
An unavailable result is never reported or stored as invalid, and never reused.
A number that fails the format check never reaches a registry.
Totals recalculation never calls a registry.
The buyer's identity, and therefore which account or cart is changed, comes from the authenticated session or the cart's own id, never from other request fields.
The VAT treatment changes only the tax of a cart or order. Prices, discounts and every other term decided by the customer segment are those of the account (or of guests), so the product page, the cart and checkout show the same prices.
A guest never receives business-segment terms, whatever VAT number they enter.
Treatment: no number, or result invalid → consumer. Result valid and prefix country = home country → domestic business. Result valid and prefix country is another EU member state or XI → intra-EU business. Result unavailable → pending, resolved by the outage policy. Result unchecked → consumer.
Greece's prefix EL and country code GR are the same country. XI numbers belong to Northern Ireland and use the EU registry; GB numbers use the UK registry.
A result is reused only for the identical normalised number, and only within its reuse period counted from the check date.
The evidence frozen onto an order is the one that decided the cart's treatment; its check date is never older than the valid-result reuse period at placement.
The buyer sees the treatment and the resulting totals before the payment step; the placed order's totals equal what was shown.
A registry outage under the default policy costs the buyer nothing but VAT they can reclaim: checkout completes with VAT charged.
A provisionally zero-rated order is always followed up: it ends with complete evidence or marked for review.
A business account keeps business terms exactly as long as its account VAT number is valid, unless the merchant decides otherwise by hand.
All settings are per website, except the re-check schedule and attempts. It is off at install.
Stores > Configuration > Magenx > VAT Number Validation
General
Checks VAT numbers against the official registries and gives the cart the tax class of its VAT treatment before payment; prices and discounts are never affected. The home country and the merchant VAT number are read from General > Store Information. Leave Customer Configuration > Create New Account Options > "Enable Automatic Assignment to Customer Group" set to No: this module replaces it.
Setting
Default
Scope
Notes
Enable VAT Number Validation magenx_vat/general/enabled
No
Website
Yes/No. Off: VAT numbers are stored as typed, nothing is checked, and carts keep the customer's own group. Evidence on placed orders is kept.
Countries Offering a VAT Number magenx_vat/general/countries
Multiple select. Shown when Enable VAT Number Validation = Yes. The storefront shows the VAT number field for these countries. Numbers from other countries are stored and never checked.
Registries
Setting
Default
Scope
Notes
Check EU and Northern Ireland (XI) Numbers Online magenx_vat/registry/eu_enabled
Yes
Website
Yes/No. No: these numbers get the format check only and count as unchecked (consumer treatment).
Check UK (GB) Numbers Online magenx_vat/registry/uk_enabled
No
Website
Yes/No. Needs application credentials from the UK tax authority's developer hub.
UK Registry Client ID magenx_vat/registry/uk_client_id
empty
Website
Text. Shown when Check UK (GB) Numbers Online = Yes. The MAGENX_VAT_UK_CLIENT_ID environment variable takes precedence.
UK Registry Client Secret magenx_vat/registry/uk_client_secret
empty
Website
Secret. Shown when Check UK (GB) Numbers Online = Yes. The MAGENX_VAT_UK_CLIENT_SECRET environment variable takes precedence.
Time Limit per Check (Seconds) magenx_vat/registry/timeout
5
Website
Text. 1–10. A registry that has not answered by then counts as unavailable, never as invalid.
Reuse Valid Results For (Hours) magenx_vat/registry/valid_ttl
24
Website
Text. 1–720. The same number is not sent to the registry again within this time. An order placed after it ends is checked again first.
Reuse Invalid Results For (Hours) magenx_vat/registry/invalid_ttl
1
Website
Text. 1–24. "Registry unavailable" answers are never reused.
VAT Treatment
Each treatment gives the cart a customer tax class; your tax rules for that class decide the rate. The cart keeps its customer group, so prices, catalog and cart price rules are never affected. "Group's own tax class" leaves the tax as it would be without this module.
Setting
Default
Scope
Notes
Intra-EU Business (Reverse Charge) Tax Class magenx_vat/treatment/intra_eu_tax_class
empty
Website
Dropdown. Valid number from another EU member state or Northern Ireland (XI). Create a customer tax class with no VAT rate for it. Until one is chosen, nothing is zero-rated.
Domestic Business Tax Class magenx_vat/treatment/domestic_tax_class
empty
Website
Dropdown. Valid number from the home country. VAT is charged.
Consumer Tax Class magenx_vat/treatment/consumer_tax_class
empty
Website
Dropdown. No number, an invalid number, or a number no registry checks. VAT is charged.
Registry Unavailable Tax Class magenx_vat/treatment/pending_tax_class
empty
Website
Dropdown. Used with the "Charge VAT" outage policy. "Group's own tax class" means the consumer tax class.
When a Registry Is Unavailable magenx_vat/treatment/outage_policy
charge_vat
Website
Dropdown. Charge VAT: checkout completes with VAT; the buyer can reclaim it. Zero-rate provisionally: reverse charge now, checked again later; orders found invalid are flagged for review. Refuse: the order cannot be placed until a check succeeds or the number is removed.
Business Accounts
Account-level, separate from the VAT treatment of a cart: a valid VAT number on the customer account (Tax/VAT number) can move the customer to your business customer group, which then decides their prices, catalog and cart price rules on every page. Address and checkout numbers never move an account. A group you set by hand is never overridden.
Setting
Default
Scope
Notes
Business Group Assignment magenx_vat/business/assignment
off
Website
Dropdown. Automatic: a valid account number moves the customer to the business group, and removing the number or finding it invalid moves them back. Review: you are notified and move the customer yourself. Anyone can type a valid number that belongs to another business; choose Review if business prices must be earned.
Business Customer Group magenx_vat/business/group
empty
Website
Dropdown. Required for Automatic and Review.
Where Numbers Are Checked
Setting
Default
Scope
Notes
Checkout magenx_vat/validation/checkout
Yes
Website
Yes/No. No: carts keep the customer's own group whatever number they carry.
Address Book magenx_vat/validation/address_book
Yes
Website
Yes/No. Check a saved address's number when it changes. An invalid number never stops the address from being saved.
Yes/No. Check the account's Tax/VAT number at registration and when it changes.
Invalid Account Number magenx_vat/validation/registration_mode
strict
Website
Dropdown. Shown when Customer Account = Yes. Strict (default) refuses storefront registration and account updates with an invalid number. A registry outage never refuses them. Admin saves are never refused.
Deferred Re-check
Orders zero-rated while a registry was unavailable are checked again on this schedule. Those found invalid, or still unchecked after the last attempt, are flagged for review in the order grid and the admin notification inbox.
Reads never break the cart, customer or order query: a disabled feature or an error returns null. validateVatNumber and recheckCartVatNumber work without sign-in and are rate-limited; protect both with Turnstile on the storefront.
Check a VAT number. Guests may call it; it is rate-limited per customer and per IP. Null when VAT number validation is off. Never cached: the answer is private to the signed-in customer.
Argument
Type
Description
country_code
String!
ISO 3166-1 alpha-2 code of the address the number is entered on, e.g. "FR". Greece is "GR"; Northern Ireland numbers (XI) go with "GB".
vat_id
String!
The VAT number as typed, with or without its country prefix. Spaces, dots and dashes are ignored.
Check the VAT number on the cart's tax address again now, without reusing an earlier result, and recalculate the cart. Use it after "registry unavailable".
Argument
Type
Description
input
RecheckCartVatNumberInput!
Fields added to Magento types
Field
Type
Description
Cart.vat_validation
CartVatValidation
The VAT treatment of the cart and the result of its tax address's VAT number. Null when VAT number validation is off.
Customer.vat_validation
AccountVatValidation
The result of the account's Tax/VAT number (taxvat). Null when the account has none or validation is off.
CustomerAddress.vat_validation
AddressVatValidation
The result of the address's VAT number. Null when the address has none.
CustomerOrder.vat_validation
OrderVatValidation
The VAT treatment the order was placed with and its evidence. Null for orders placed without one.
StoreConfig.vat_validation_enabled
Boolean
Whether VAT numbers are checked on this store. The two flags below only apply when this is true.
StoreConfig.vat_validation_checkout
Boolean
Whether the checkout address's VAT number is checked and decides the cart's VAT treatment. Offer the checkout field only when true.
StoreConfig.vat_validation_registration
Boolean
Whether the account's VAT number is checked at registration and in the account details. Offer those fields only when true.
StoreConfig.vat_validation_registration_mode
String
"warn" or "strict": whether an invalid account VAT number refuses registration.
StoreConfig.vat_number_formats
[VatNumberFormat!]
Countries that offer a VAT number field, with an example of each one's format. Null when validation is off.
Types
input RecheckCartVatNumberInput - The cart to re-check.
Field
Type
Description
cart_id
String!
The masked cart id.
type RecheckCartVatNumberOutput - The re-checked cart.
Field
Type
Description
cart
Cart!
The cart, with its VAT treatment and totals recalculated.
enum VatValidationStatus - The outcome of validating a VAT number.
Value
Description
VALID
The format is right and the registry confirmed the number.
INVALID
The format is wrong, or the registry says the number is not registered.
UNAVAILABLE
The registry could not answer. Not the same as invalid.
UNCHECKED
No registry checks numbers from this country, or checks are off.
enum VatTreatment - How VAT applies to a cart or order.
Value
Description
DOMESTIC_BUSINESS
Valid number from the merchant's own country. VAT is charged.
INTRA_EU_BUSINESS
Valid number from another EU member state or Northern Ireland. VAT is reverse charged (zero).
CONSUMER
No number, an invalid one, or one no registry checks. VAT is charged.
PENDING
The registry could not answer. The store's outage policy decides whether VAT is charged.
type VatNumberValidation - The result of checking one VAT number.
Field
Type
Description
vat_id
String!
The normalised number, e.g. "FR40303265045", or the input when it could not be normalised.
status
VatValidationStatus!
The outcome.
registered_name
String
The business the number is registered to, when the registry discloses it.
registered_address
String
The registered address, when the registry discloses it.
checked_at
String
When the registry answered (UTC, ISO 8601). Null when no registry was asked.
message
String!
Buyer-facing message in the store's language.
type CartVatValidation - The VAT treatment of a cart.
Field
Type
Description
treatment
VatTreatment!
The treatment decided from the tax address's VAT number.
reverse_charged
Boolean!
Whether the cart's totals carry no VAT because of reverse charge, including provisional reverse charge during a registry outage.
vat_id
String
The tax address's normalised VAT number, or null when it has none.
status
VatValidationStatus
The result for that number, or null when there is none.
registered_name
String
The registered business name, when disclosed.
placement_blocked
Boolean!
Whether the order cannot be placed until the number is checked or removed.
message
String!
Buyer-facing message, e.g. "VAT reverse charged."
type AccountVatValidation - The result of an account's VAT number.
Field
Type
Description
vat_id
String!
The normalised number.
status
VatValidationStatus!
The outcome.
checked_at
String
When it was checked (UTC, ISO 8601).
business_account
Boolean!
Whether the account is in the store's business customer group with this number valid, so it gets business prices and rules.
type AddressVatValidation - The result of a saved address's VAT number.
Field
Type
Description
status
VatValidationStatus!
The outcome.
checked_at
String
When it was checked (UTC, ISO 8601).
type OrderVatValidation - VAT treatment and evidence frozen on an order.
Field
Type
Description
treatment
VatTreatment!
The treatment at placement.
reverse_charged
Boolean!
Whether the order was placed with VAT reverse charged.
vat_id
String
The VAT number used.
status
VatValidationStatus
The result at placement.
consultation_reference
String
The registry's reference for the check, when it returned one.
checked_at
String
When the number was checked (UTC, ISO 8601).
type VatNumberFormat - A country's VAT number format.
Field
Type
Description
country_code
String!
ISO 3166-1 alpha-2 country code.
prefix
String!
VAT prefix, e.g. "EL" for Greece.
example
String!
A well-formed example number, e.g. "DE136695976". Not a real business.
A value-added-tax identification number: a country prefix followed by the national number.
Country prefix
The two-letter code that starts a VAT number. It is the country's code except for Greece (EL) and Northern Ireland (XI).
Normalised number
The VAT number in upper case, with the country prefix, and with spaces, dots, dashes and slashes removed.
Home country
The country where the merchant is established for VAT, set per website.
Merchant VAT number
The merchant's own VAT number, sent as the requester on registry checks so the registry returns a consultation reference.
Format check
A local check of length, allowed characters and, where the country defines one, the check digit. No network call.
Registry
An official online service of a tax authority that answers whether a VAT number is valid. Release 1 uses two: the EU registry (EU member states and XI) and the UK registry (GB).
Registry check
One call to a registry for one number.
Validation result
The outcome of validating a number: valid, invalid (format check failed or the registry says not valid), unavailable (the registry could not answer), or unchecked (no registry covers the country, or validation is off).
Consultation reference
The identifier a registry returns for a check, which proves the check took place.
Validation evidence
The normalised number, registry, result, registered name and address (if disclosed), consultation reference, and date and time of the check.
Result reuse
Answering a check from a recent result for the same normalised number instead of calling the registry again.
Tax address
The cart address the store's tax settings use to calculate tax (billing or shipping). Its VAT number decides the treatment.
VAT treatment
How VAT applies to a cart or order: domestic business (valid number from the home country — VAT charged), intra-EU business (valid number from another EU member state or XI — reverse charge, zero VAT), consumer (no number, or an invalid one — VAT charged as for a private buyer), pending (the registry was unavailable — handled by the outage policy).
Tax category
The merchant-configured customer category that the store's tax rules use to pick a rate. Each VAT treatment maps to one tax category. It decides the tax rate only.
Customer segment
The merchant's grouping of customers that decides prices, discounts and other commercial terms. Every customer has one; guests share one. The VAT treatment never changes it.
Business segment
The customer segment the merchant chooses for verified business accounts.
Account VAT number
The VAT number on the customer account itself, entered at registration or in the account details, independent of any address.
Assignment mode
How a valid account VAT number moves a customer to the business segment: off, automatic, or review (the merchant is notified and decides).
Outage policy
What happens at checkout when a registry is unavailable: charge VAT (default), zero-rate provisionally, or refuse.
Deferred re-check
A later registry check for an order placed while its result was unavailable.
Order for review
An order whose deferred re-check returned invalid, or never succeeded, after it was zero-rated provisionally.