javascript
Adding the async attribute can cause the inline code to return undefined because the library may not be available at that moment. So avoid the use of async and defer for now.
javascript
| 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 | This is called when your user has successfully completed enrollment with their preferred institution. The sample response data below is passed to the widget | |
| onError | function | This is called when your user was unable to successfully complete enrollment. | |
| onClose | function | This is called when the widget is closed. |
onSuccess — What it really means
onSuccess — What it really means
The
onSuccess callback only confirms that the user has completed the verification flow on the widget. It does not mean the user passed all verification checks.For example, a user might complete the process but still fail a document validation, liveness check, or other verification step. Relying only on onSuccess to approve a user can lead to incorrect verification decisions.onError — When errors occur
onError — When errors occur
The
onError callback is triggered when an error occurs during the verification process. This could be due to:- Network issues
- SDK initialization problems
- Configuration errors
- An interruption during the verification flow
onClose — Widget closed behavior
onClose — Widget closed behavior
The
onClose callback is triggered when the verification widget is closed. Currently, a verification terminated event is sent to indicate that the user closed the widget before completing the verification process.Updated behavior: After a user goes through the verification steps and onClose is triggered, the widget will close and the user will be redirected to the redirect URL (if configured). The final verification status will then be delivered through the webhook notification.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. |
Typescript implementation
If you want to use typescript on some classes that are not available now or in the future, you could look at extending the global ‘window’ interface. You can follow below steps to guide you: With typescript, you need to extend the global Window interface with additional properties. Create a new folder “types” Add a file “index.d.ts” Put below code inside your “index.d.ts” filetypescript
typescript
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