i18n-rules
Per-country address rules, served at https://i18n-rules.nextcommerce.com. Given a country, the API answers with the fields an address form needs, in the order that country writes an address, with their labels in the page's language, what is required, and how each value is checked and written. Given what a shopper typed, it checks it: a phone number comes back in E.164, read with libphonenumber, and a postcode is checked against the state it was typed with.
An address form written as line1 / line2 / city / state / zip is wrong nearly everywhere outside the US. Germany collects no state, Hong Kong no postcode, and Japan writes its postcode first. The API makes the country the input and the form the output: 91 countries with a layout of their own, a permissive default for the rest, and 12 languages.
Start here
- Getting started: load a form and draw its fields.
- How countries differ: what varies, and why.
- Checking a phone number: the E.164 number an order submits, from
POST /v1/validate. - Checking a postcode: whether a postcode is the chosen state's, from the same route.
Browse the rules
- All countries: each country's form, fields, postcode and phone rules, how each state's postcodes start, states and messages.
- All languages: every text a form shows, in each language.
Reference
- Routes, Caching, Errors and Versioning.
- Fields: the eleven fields every country draws from.
- Payment errors: the sentence a shopper sees for each declined payment.
- The response types, in the sidebar under Responses, Fields, Formats and Names, and the request and answer of
POST /v1/validateunder Validation.