Instead of building your own flow, it’s highly recommended to fork an existing flow from the public sample codes found here

Overview of this Example

Features
  • OneSDK eKYC-only flow
  • Country-specific form fields
  • Multi-step verification process
  • Retry handling mechanism
Supported Countries
  • Philippines (PHL)
  • Australia (AUS)
  • Singapore (SGP)
  • China (CHN)

Implementation Guide

1

Initialize OneSDK

1const oneSDKInstance = await OneSdk({
2// Pass session object received from backend for authentication
3session: sessionObjectFromBackend,
4// Set environment mode to production
5mode: "production",
6});
2

Set Up Individual Profile

1const oneSdkIndividual = oneSDKInstance.individual();
2oneSdkIndividual.setProfileType("auto");
3

Configure Form Components

1 // Initialize IDV (Identity Verification) flow
2const idv = oneSdkInstance.flow('idv');
1// Listen for loading state changes and update UI accordingly
2idv.on('loading', (l: boolean) => {
3 setLoading(l);
4});
5
6// Handle IDV completion process
7const handleIDVFinished = async () => {
8 try {
9 // Submit individual verification request
10 let res = await oneSdkInstance.individual().submit({ verify: true });
11 } catch (e) {
12 // handle handle case with your custom logic here
13 console.error(e);
14 }
15}
16
17// Listen for IDV results and process completion
18idv.on('results', async () => {
19 await handleIDVFinished();
20});
21
22// Handle any IDV errors by showing failure form
23idv.on('error', (e: any) => {
24 // handle handle case with your custom logic here
25 console.error(e);
26});
27
28// Mount IDV form to DOM element with id "form"
29idv.mount("#form");
Built with