SDK reference, Incode Web SDK 2 Reference / Web SDK 2 Individual Modules

eKYC Module

Warning

This guide is specific to Web SDK 2.x. For Web SDK 1.x, you can find documentation here.

Do not attempt to upgrade or implement without support. Contact your Incode representative to check if you are a candidate for this upgrade.

The eKYC (electronic Know Your Customer) module collects identity verification data through a configurable form including name, address, phone, email, SSN/tax ID, date of birth, ID numbers, etc. and submits it to Incode's KYC verification engine. The displayed fields and their data sources (manual entry, document OCR, prior phone/email modules) are Dashboard-driven.

This module follows a form-based pattern variant — Dashboard-driven dynamic field schema with optional pre-fill from earlier modules.

Tag

<incode-ekyc> is a standard Web Component. Importing the UI subpath registers the custom element; importing the CSS applies the module's styles.

import '@incodetech/web/ekyc';
import '@incodetech/web/ekyc/styles.css';

Properties

Property Type Required Description
config EkycConfig ❌ eKYC configuration
onFinish () => void ❌ Called when KYC submission completes
onError (error: string) => void ❌ Called when an error occurs

Configuration

type EkycConfig = {
  flowId?: string;
  verificationFields?: EkycVerificationFields;
  source?: string;
  fieldsCountry?: string;
  enablePhoneRisk?: boolean;
  autoExecution?: boolean;
  displayModes?: EkycDisplayModes;
};
Option Type Required Description
flowId string ❌ Session flow ID; injected by the orchestrator.
verificationFields EkycVerificationFields ❌ Per-field source map. Each value is 'user_input' | 'document_scan' | 'poa_document' | 'phone_module_input' | 'email_module_input' | false (omit).
source string ❌ Backend-side override for default field source.
fieldsCountry string ❌ ISO country code; controls country-specific field rendering.
enablePhoneRisk boolean ❌ Enable phone-risk subprocess on submit.
autoExecution boolean ❌ The backend runs the checks itself, so the module finishes without a form or a submission. See Auto execution.
displayModes EkycDisplayModes ❌ How each field shows, keyed like verificationFields: 'editable' (the default), 'readOnly' or 'hidden'. See Display modes.

The full list of EkycVerificationFields keys: name, address, phone, email, SSN, taxId, nationality, 'date of birth', dlNumber, dlState, dlExpireAt, last4SSN, idNum, idNum1, gender, panNumber, idType, issueDate, fileNumber. Each field can be sourced from manual entry, OCR'd ID data, POA document data, or a prior phone/email module.

Dashboard field configuration

EkycConfig above is what you set in application code. The dashboard sends its own shape, EkycModuleConfig, which the orchestrator resolves into the rendered form. You do not set it yourself, but it is exported from @incodetech/core/ekyc so you can type a response you inspect.

It configures each verifiable field with three properties:

  • check<Field> (boolean): whether to verify that field at all.
  • <field>Source (string): where its value comes from, using the same source names as verificationFields.
  • <field>DisplayMode ('editable' | 'readOnly' | 'hidden'): how the field shows. See Display modes.

For example, checkName, nameSource and nameDisplayMode. They cover Name, Email, Address, Phone, Ssn, Dob, Nationality, DlNumber, DlState, DlExpireAt, Last4SSN, IdNum, IdNum1, Gender, PanNumber, IdType, IssueDate and FileNumber. A top-level source sets the default for fields with no explicit source, riskAddons and enablePhoneRisk carry the risk configuration, and autoExecution hands the checks to the backend (see Auto execution).

To change which fields a flow verifies, edit the eKYC module in your dashboard rather than passing config in code.

Data sources

The source value, set in Dashboard, selects the data source the module verifies against. The source also decides which fields the form shows, which are required, and how each is checked, such as the postal code format or the phone length. Set fieldsCountry only to override the country the form renders for. The table lists the sources documented here. Your Dashboard configuration can enable other sources, and they use the same form.

Country Sources available before 2.5.0 Added in 2.5.0
Argentina AR_1 AR_CREDIT_BUR_1, AR_RES_REGISTER
Belgium BE_CREDIT_TELCO
Brazil BR_GOVT_1, BR_CPF_1 BR_TAX_PHONE_REGISTER
Canada CA_RES_CREDIT CA_CREDIT_FINTRAC, CA_TELCO
Chile CL_1 CL_CIVIL_REGISTER_2
Colombia CO_CIVIL_REGISTER_1
Denmark DK_CIVIL_REG_CREDIT_TELCO
Finland FI_CONSUMER_POP_REG_TELCO, FI_NATIONAL_ID
Germany DE_PHONE_MOBILE_REGISTER
Greece GR_1
Guatemala GT_1
Hong Kong HK_RESIDENT_REGISTER
India IN_DMV, INDIA_PAN_1, INDIA_PASSPORT_1
Italy IT_CIVIL_REG_CREDIT_TELCO
Kyrgyzstan KG_VOTER_REGISTER
Mexico MX_CONSUMER_1 MX_CIVIL_REGISTER_2
Netherlands NL_CIVIL_REG_CREDIT_TELCO, NL_CONSUMER_POP_REG_TELCO
Norway NO_CONS_POP_REG
Peru PE_CIVIL_REGISTER_2
Philippines PH_RES_CREDIT
Portugal PT_CIVIL_REG_CREDIT_TELCO
Romania RO_VOTER_REGISTER
Singapore SG_PHONE_REGISTER
Spain ES_1 ES_PHONE_REGISTER_2
United Kingdom UK_CREDIT_BUREAU_1, UK_VOTER_REGISTER GB_2X2
United States US_DRIVERS_LICENSE_1, US_TELCO_1, US_TELCO_2, US_CONSUMER_1, US_CREDIT_BUREAU_1, US_CREDIT_TELCO US_CREDIT_BUREAU_3
Venezuela VE_CIVIL_REGISTER

RISK_ADDONS_ONLY is not a data source. See Risk addons.

Some sources change what the form asks for:

  • HK_RESIDENT_REGISTER adds an optional building name and offers the Hong Kong region as a dropdown. In eKYC and eKYB, choosing an address suggestion fills the region dropdown only when the suggestion's region matches one of its options, ignoring case. Otherwise the previous selection stays.
  • CA_TELCO and CA_RES_CREDIT offer the province as a dropdown. BR_GOVT_1 offers the Brazilian state as a dropdown and sends its two-letter code, such as RJ. Its address fields are optional.
  • BR_GOVT_1 nationality options are brazilian, naturalized_brazilian, brazilian_born_abroad and foreigner.
  • CL_CIVIL_REGISTER_2 accepts the national ID (RUT) with dots, a hyphen or spaces and removes them as the user types. It checks the verification digit.
  • ES_PHONE_REGISTER_2 accepts the DNI with a hyphen, dots or spaces and removes them as the user types.
  • INDIA_PASSPORT_1 and MX_CIVIL_REGISTER_2 uppercase the passport, file number and CURP as the user types. MX_CIVIL_REGISTER_2 checks the CURP layout.
  • PH_RES_CREDIT asks for the ID type (TIN, SSS or GSIS) once the user enters an ID number, and checks the number for that type.
  • Sources whose provider takes the house number inside the street (Denmark, FI_NATIONAL_ID, GB_2X2, Italy, Peru, the Philippines, Portugal, and Romania, plus NL_CIVIL_REG_CREDIT_TELCO) label the field "Street and house number" and show no separate house number field.

Postal codes are checked against the country's format, for example 4 digits for Belgium, Denmark, and Norway, 6 digits for India, Romania, and Singapore, 5 digits for Finland and Greece, and 4 digits plus 2 uppercase letters for the Netherlands.

Every source rejects a date of birth more than 120 years ago. The street field always comes before the house number. Name fields keep hyphens, apostrophes, and letters from any script as the user types, so Jean-Luc and Müller stay as typed.

The phone country list includes Kyrgyzstan (+996), so users of KG_VOTER_REGISTER can add a phone risk addon.

Risk addons

The dashboard-driven module config exposes a riskAddons array (RiskAddon: 'phoneCheck' | 'advancedPhoneCheck' | 'emailCheck' | 'phoneProfile'). A matching addon renders the corresponding input even when its checkPhone / checkEmail flag is off:

  • phoneCheck, advancedPhoneCheck, or phoneProfile renders the phone input.
  • emailCheck renders the email input.

A module source of RISK_ADDONS_ONLY runs the eKYC form purely to collect the inputs the configured risk addons need, without a full identity-data check. These values come from the Dashboard flow configuration, so most callers pass them through unmodified.

When riskAddons includes phoneProfile and the source is RISK_ADDONS_ONLY, the module submits with source: 'PHONE_PROFILE'. The phone input is required, and the user can change its country. The payload leaves out countryCode:

{ "plugins": ["kyc"], "source": "PHONE_PROFILE", "phone": "+12025550101" }

Any other inputs that addons render (for example, email from emailCheck) are still sent with that payload.

With autoExecution: true, the addons render no inputs: the module skips the form and the backend runs the checks. See Auto execution.

Auto execution

When the module config has autoExecution: true, the backend runs the eKYC checks, such as phone and email risk. It uses data that earlier modules in the flow collected, for example the Phone Number Input or Email Input module, so the module doesn't ask the user for that data again.

The module then moves from loading to finished and calls onFinish. It renders no form and it makes no prefill or submission request. With a flowId, it fetches the module config first and finishes as soon as that config has autoExecution: true.

This differs from a form whose fields are all hidden (see Display modes). There, the module still builds the form and submits it on its own. With autoExecution, the module submits nothing because the backend owns the execution.

State machine

EkycState is a discriminated union over status:

Status Description
loading Fetching field schema and any pre-fill data from prior modules.
form Rendering the configured form fields; user enters / corrects data.
submitting Submitting to the eKYC backend.
success Submission accepted.
finished Terminal. Also reached right after loading with autoExecution.
closed User dismissed.
error Submission or load error.
misconfigured The backend returned no usable field configuration; can't render the form.

Form-state properties

These fields exist only when status === 'form'; submitting carries no form payload.

Property Type Description
fields EkycFieldDef[] Ordered field descriptors for rendering.
values Record<string, string | undefined> Current values, including available prefill.
validationErrors EkycValidationErrors? Field-name map of { key: string, params?: Record<string, string | number> }; translate each key with its parameters.
isValid boolean No validation errors currently displayed; initially optimistic, not proof of completeness.
addressSuggestions AddressSuggestion[] Current address-search results.
prefilled Record<string, boolean> Marks fields populated from earlier verification data.
hideEmail boolean Whether the email control should be hidden.
fieldsCountry string Country used to render the schema.
submitError string Submission feedback retained on the form.
steps EkycStep[] The form's screens, in order. Each step has an id ('personal', 'driverLicense', or 'address') and its fieldNames. A form with one step has a single screen.
currentStepIndex number Index into steps of the screen the user is on.
isStepValid boolean No validation errors on the current step's fields.

Use EkycState from @incodetech/core/ekyc for the complete union.

Form steps

The form splits into steps, one per section: personal details first, then Driver's License details and Address details when the source asks for them. Fields without a section stay on the personal step. A step with no visible field is left out, and so is an email field that another module already shows.

The built-in UI shows one step at a time with a progress bar and a Back button. Continue checks the current step's fields and moves to the next step. On the last step, Continue submits.

When you drive the module headless, render fields for the step at steps[currentStepIndex] (fieldNames lists their names). Call next() for Continue and back() for Back. submit() still validates and submits the whole form from any step. When a field fails, the form moves to the first step with an error.

Display modes

A field in fields can carry a displayMode. Core sets it once the prefill data from earlier modules has arrived:

  • editable, or no displayMode: render the field as usual.
  • readOnly: render it read-only, showing its value. The field also has readonly: true, and the manager ignores changes to it.
  • hidden: don't render it. Its value is still validated and sent.

A field configured hidden or readOnly becomes editable when the user has to supply its value: a required field in its group has no valid prefilled value, or a "one of" rule over it has none. An optional field with no value keeps its mode and sends nothing. A value from the phone or email module, or from a phone or email risk addon, shows at least read-only. When every field is hidden, the module submits on its own without showing the form. If that submit fails, the module shows its error screen with Retry and Skip. When prefill data can't be fetched, the configured modes still apply, as if no value was found.

Error feedback

After narrowing state.status to error, read state.errorMessage (string) for failure feedback. It can be empty, so provide a translated fallback. This field is only present in that error state; use the recovery actions below.

API methods

Fields come from the dashboard schema, so this module uses one keyed setter rather than a setter per field.

Method Purpose Callable when
load() Fetch the field schema and any prefill from earlier modules. loading
setField(name, value) Set one field, keyed by its name in the schema. form
validateField(name) Validate one field. Call it on blur. form
searchAddress(query) Fetch address autocomplete suggestions. Debounce it yourself. form
selectAddress(suggestion) Apply one suggestion from searchAddress. A street-level result is required. form
next() Validate the current step and move to the next one. On the last step, submit. form
back() Return to the previous step. Keeps values and errors, and does not validate. form
submit() Validate and submit the whole form, whatever the current step. form
retry() Return to the form after a submission error. error
skip() Skip verification and continue the flow past the failure. error
close() Close the module. form, error, misconfigured

See also

Was this page helpful?