Client Callbacks
Do not rely on callbacks for critical business logic
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.
onLoad & onReady
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.
onCancel
The onCancel
callback is called when an individual cancels the inquiry flow before completion.
onComplete
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 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](/
webhooks).
onError
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.)
Below is a list of Persona error codes.
onEvent
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.
Other supported events include: