Skip to main content
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

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

Set Up Individual Profile

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

Configure Form Components

 // Initialize IDV (Identity Verification) flow
const idv = oneSdkInstance.flow('idv');
// Listen for loading state changes and update UI accordingly
idv.on('loading', (l: boolean) => {
  setLoading(l);
});

// Handle IDV completion process
const handleIDVFinished = async () => {
 try {
   // Submit individual verification request
   let res = await oneSdkInstance.individual().submit({ verify: true });
 } catch (e) {
    // handle handle case with your custom logic here
    console.error(e);
 }
}

// Listen for IDV results and process completion
idv.on('results', async () => {
  await handleIDVFinished();
});

// Handle any IDV errors by showing failure form
idv.on('error', (e: any) => {
  // handle handle case with your custom logic here
  console.error(e);
});

// Mount IDV form to DOM element with id "form"
idv.mount("#form");