Gravity Forms SIREN/SIRET Fields
**SP Gravity Forms SIRET Field** adds a dedicated **French SIRET / SIREN field** to Gravity Forms with
real, server-side validation: an instant local checksum test (Luhn, including the *La Poste* exception)
followed by an optional live lookup against the **INSEE Sirene API**. A confirmed number does not just
return “valid” — the company name, trade name, legal form, APE/NAF code, founding date and full address
are fetched with it, cached for 35 days and, if you like, written into a Gravity Forms form. The lookup
engine ships as a **standalone, Gravity-Forms-independent library** that any other plugin can reuse.
Features
- **SIRET / SIREN form field** — drag-and-drop field in the form editor (group *e-Invoicing Fields*),
with a per-field selector for the identifier type. - **Comfortable block input** — the number is typed in grouped blocks exactly as it is printed:
`123 456 789 00012` for a SIRET (3·3·3·5) and `123 456 789` for a SIREN (3·3·3). Auto-advance,
Backspace walks back, and pasting a complete number spreads it across the blocks automatically.# - **Local checksum validation** — length plus **Luhn** check, including the documented *La Poste*
exception, before any network call is made. - **Live INSEE Sirene lookup** — confirms the identifier against the official French business register
(**INSEE Sirene API v3.11**) using your API key from the new `portail-api.insee.fr` portal. - **Company data included** — a confirmed lookup returns the legal name (or person’s name), trade name
(*enseigne*), legal category, APE/NAF activity code, enterprise category (PME/ETI/GE), founding date,
head-office flag, administrative status and the complete establishment address. - **Optional “must be active” rule** — treat companies that exist but are administratively *ceased*
(legal unit) or *closed* (establishment) as invalid, or accept any register hit. - **Never blocks on outages** — only a definitive *not in the register* (HTTP 404) rejects a submission.
A missing key, rate limit, timeout or server error is reported as *unavailable*, and the locally
checksum-validated value is accepted. - **35-day cache** — every confirmed record is stored in the plugin’s own MySQL table, so repeat
submissions of the same number never cost an API call. A stale cache entry is even used as a fallback
when INSEE is unreachable. - **Selectable cache table** — use the plugin’s own table (created automatically), share an existing
cache table with other add-ons, or switch the database cache off entirely. - **Optional Gravity Forms mirror** — write the register data into a Gravity Forms form via the GFAPI,
one entry per company, updated in place on refresh. A ready-to-import form is included, using the
plugin’s own SIRET field for the identifiers, a **date** field for the founding date and an **address** field for the address. - **Reusable lookup library** — `SP_INSEE_Validator` is dependency-free and has no hard dependency on
Gravity Forms, so any plugin can use it for Luhn checks, INSEE lookups and the cache. - **Reusable Settings API fields** — `siren` and `siret` field types for the Gravity Forms Settings API,
usable in any add-on’s plugin or feed settings, with the same validation. - **Normalized storage** — identifiers are stored digits-only and displayed grouped for readability.
- **Gravity Forms logging** — all diagnostics go through the standard Gravity Forms logging
(Forms → Settings → Logging), so a failed lookup is easy to trace. - **Internationalized** — **English, German and French** translations included (French being the
obvious one for a form that collects French company numbers). - **Dependency-free** — the REST call uses the WordPress HTTP API; no Composer packages required.
