SDK callbacks are intended for coordination between your app’s UI and Persona’s UI (e.g. opening and closing the flow UI). They do NOT guarantee that data are up-to-date, and cannot be reliably used to guarantee data integrity. Webhooks should be used for logic that depends on Inquiry state.
For more information, see Accessing Inquiry status and data.
The onLoad callback is called when the iframe finishes loading and is ready to be displayed. It does not take any arguments.
The onReady callback is called when the inquiry flow is ready for user interaction. It does not take any arguments.
The onCancel callback is called when an individual cancels the inquiry flow before completion. It receives a single object argument with the following properties:
The ID of the inquiry used in this instance of the flow. Will be undefined if the flow is canceled before an inquiry is created.
A token that can be used to resume the inquiry. Will be undefined if the flow is canceled before an inquiry is created.
The onComplete callback is called when the inquiry has completed the inquiry flow and the individual clicks on the complete button to close the flow.
The purpose of this callback is to signal when the user has completed the Persona flow and should be sent back to your application. onComplete is not guaranteed to be called; it is possible that the user never presses the complete button.
onComplete receives the current status of the inquiry as an argument. These values are passed for convenience, and are not guaranteed to be up to date. For instance, a Workflow may have been executed between when the inquiry was completed and when the user pressed the complete button, resulting in a status change. If you need the most up to date state of the inquiry, please use Webhooks.
It receives a single object argument with the following properties:
The ID of the inquiry used in this instance of the flow.
The status of the completed inquiry (e.g. 'completed', 'failed').
A map of field values. See Fields documentation.
The onError callback is called in response to errors in the inquiry flow that prevent the inquiry flow from being usable. These generally occur on initial load.
onError is not fired for network errors (e.g. dropped requests from bad connections, blocked requests due to application security settings, etc.)
It receives a single object argument with the following properties:
The HTTP error status, if applicable. The value will be 0 if the error was an application error.
A short string describing the error. See the error codes below.
The onEvent callback is called at certain points in the Persona flow. It takes two arguments: an eventName string and a metadata object.
onEvent is sometimes passed the current state of the inquiry for convenience purposes. These values are not guaranteed to be the latest values on the inquiry, and thus should not be used for critical logic. If your business logic depends on granular verification and inquiry status changes, we recommend using Webhooks.
By default, only legacy events are forwarded to onEvent. To receive newer events like step-transitioned, click, and form-update, you must opt in using the eventsAllowlist parameter (available in SDK 5.8.0+):
eventsAllowlist: 'all' — receive all events.eventsAllowlist: [Event.Click, Event.StepTransitioned, ...] — receive only the specified events.startTriggered when an Inquiry object has been created in the client. Dynamic Flow Templates will send this event at the same time as 'ready', and it will not indicate user interaction. Legacy 2.0 Templates will send this event only when the user clicks ‘Continue’ on the start screen.
The ID of the inquiry.
document-camera-selectThe individual is opening the camera for the government ID verification.
Data about the current step.
The class of the government ID being captured, if known.
document-camera-captureThe individual took a photo for the government ID verification.
Data about the current step.
The class of the government ID being captured.
An array of objects describing the captured files.
Which side of the document was captured.
How the document was captured (e.g. 'manual', 'auto').
document-uploadThe individual uploaded a government ID photo.
Data about the current step.
The class of the government ID being uploaded.
An array of objects describing the uploaded files.
Which side of the document was uploaded.
How the document was captured.
documents-save-successfulThe inquiry flow successfully saved captured documents.
Data about the current step.
The class of the government ID that was saved.
An array of objects describing the saved files.
Which side of the document was saved.
How the document was captured.
documents-save-failThe inquiry flow failed to save captured documents.
Data about the current step.
The class of the government ID that failed to save.
An array of objects describing the files that failed to save.
Which side of the document.
How the document was captured.
selfie-camera-selectThe individual is opening the camera for the selfie verification.
selfie-camera-captureThe individual took a photo for the selfie verification.
Data about the current step.
An array of objects describing the captured selfie files.
The pose of the selfie.
How the selfie was captured.
selfie-record-uploadThe individual uploaded a selfie photo. This is allowed when their browser does not support embedded video.
load-camera-failedThe inquiry flow failed to load the camera during a government ID capture, selfie, or document upload flow. This can happen due to missing permissions or a hardware error.
one-time-link-sentThe individual sent a one time link to their mobile device.
one-time-link-startThe individual resumed their flow on their mobile device using a one-time link.
one-time-link-exitThe individual returned to their initial device after sending a link to their mobile device.
completeThe individual is exiting the flow after verifying their identity.
page-changeThe current page in the Inquiry flow changed. This is primarily used with the Inlined React flow to dynamically resize the widget based on the contents of the current page.
Name (unique identifier) of the next step.
Descriptive name of the next step as seen and configured in Flow Editor.
String representing the step type.
Height in pixels of the content on the current page.
step-transitionedFired when the user transitions between steps in the inquiry flow. Requires eventsAllowlist. Available in SDK 5.8.0 and above.
The unique identifier of the step the user is leaving.
The display name of the step the user is leaving.
The direction of the transition (e.g. 'forward').
clickFired when the user clicks on an interactive element in the inquiry flow. Requires eventsAllowlist. Available in SDK 5.8.0 and above.
The type of component that was clicked (e.g. 'button_submit', 'navbar_back', 'id_class_select').
The visible label of the clicked element, if applicable.
The unique identifier of the current step.
A value associated with the click, if applicable. For example, 'dl' for a driver’s license selection or 'autocapture' for a camera option.
form-updateFired when a form field value changes in the inquiry flow. Requires eventsAllowlist. Available in SDK 5.8.0 and above.
The unique identifier of the form field.
The type of interaction that triggered the event.
The validation result after the interaction (e.g. 'valid').
The validation error message, if any.