npm
yarn
React JS
| Parameter | Type | Description |
|---|---|---|
| type | string | Widget Type: Values are ‘custom’, ‘verification’, ‘identification’, ‘verification’, ‘liveness’ |
| app_id | string | Application Id, Get it from your dojah application dashboard here |
| p_key | string | Public Key, Get it from your dojah application dashboard here |
| reference_id | string | Reference ID, It can be passed to keep track of the verification steps (Started, Ongoing, Successful). NB: reference_id character length must be greater than 10 |
| widget_id | string | Widget ID, Get it from your Easy Onboard application dashboard here |
| user_data | object | Automatically update the user data page, and thus skip the page |
| gov_data | object | Automatically update the government data page, and thus skip the page |
| metadata | object | Your application’s metadata to be passed back to you via webhook, onSuccess, or onError |
| onSuccess | function | Called when the user has completed all verification steps in the widget flow. The sample response data below is returned to this callback. |
| onError | function | Called when an error occurs before all verification steps are completed, preventing the user from finishing the flow. |
| onClose | function | Called when the user terminates the widget via the close button before completing all steps. |
onSuccess — All verification steps completed
onSuccess — All verification steps completed
The
onSuccess callback is triggered when the user has completed all the verification steps configured in the widget flow. This confirms that every step — such as document capture, liveness check, government data entry, etc. — has been submitted by the user.Important: onSuccess confirms flow completion, not that the user passed all checks. A user may complete every step but still fail backend validation (e.g., document mismatch, failed liveness). Always verify the final result from your backend using the reference ID.onError — Error before all steps are completed
onError — Error before all steps are completed
The
onError callback is triggered when an error occurs before all verification steps are completed. This prevents the user from finishing the flow. Common causes include:- Network connectivity issues
- SDK initialization or configuration errors
- Provider-side failures during a verification step
- Unexpected interruptions during the flow
onError fires, the verification is incomplete. Your application should handle this gracefully — for example, by prompting the user to retry.onClose — Widget terminated via close button
onClose — Widget terminated via close button
Recommended ImplementationAfter the widget interaction, create a backend flow or confirmation page that retrieves the actual verification result using the reference ID generated during the verification process. You can retrieve the final verification details through:
- Webhook notifications — Subscribe to services
- Verification Details API — Get verification details
| Status | Description |
|---|---|
| Ongoing | The verification process is currently in progress. |
| Completed | The verification has been successfully completed and passed all checks. |
| Pending | The verification is awaiting further action or review. |
| Failed | The verification was completed but did not pass one or more verification checks. |
| Abandoned | The verification was started but not completed by the user. |
onSuccess callback is invoked with the verification response data. If an error occurs before all steps are completed, onError is called instead. If the user closes the widget via the close button, onClose is triggered.
Use the overall status (response.status (Boolean, i.e true or false)) to ascertain if the request failed or succeeded.
Webhook NotificationsYou can receive the same data below (also passed to onSuccess and onError) via a webhook call.Register your url for webhook calls here and ensure
kyc.widget is the service you are subscribed to.In Config object Kindly set webhook object value to true (Boolean)Example : webhook : trueResponse
How to retrieve the Selfie PhotoThere’s a response object that is sent to the client via the widget launcher on success or failure. selfieUrl and idUrl under selfie and id in the success response objects, which holds the final selfie capture and id capture respectively.