LanguageValues and typesStandard typesTax and identity numbers
VatNumber
On this page
A VAT registration number, with its country's code at the front: GB980780684.
Use it for a business's VAT number on invoices. For a taxpayer's number other than VAT, use TaxId.
Shape
| Field | Type | Required? |
|---|---|---|
country |
Country |
Yes |
number |
Text |
Yes |
Its parts keep these rules, and a value that breaks one fails with the rule's name:
number_of_country: number is in the form of its country's numbers
Example
VatNumber { country: Country.gb number: "980780684" }text.parse(raw, as: VatNumber) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as GB802311781, DE143454215 or FR84323140391.
Good to know
- Greek numbers start
EL, notGR, as the EU's VIES service writes them. - It checks each country's form and check digit, but it doesn't ask a tax office whether the number is registered.
==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
A string, in a request, a response or json.write:
"GB980780684""DE143454214""FR59542051180"
Details
Text form, storage, how it is shown, and operations
VatNumber is in the group Tax and identity numbers, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: GB980780684, DE143454214 and FR59542051180.
How it is stored
It is stored in 2 columns, each named for the field, _ and its suffix. This is IE6388047V:
| Column | Type | Holds |
|---|---|---|
<field>_country |
text |
'IE' |
<field>_number |
text |
'6388047V' |
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
GB980780684 |
GB980780684 |
DE143454214 |
DE143454214 |
FR59542051180 |
FR59542051180 |
IE6388047V |
IE6388047V |
EL094259216 |
EL094259216 |
AU51824753556 |
AU51824753556 |
Operations
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-vat-number.md.Built from Jadpo main at aee2e8f.