Widget
The Relay widget handles the entire user-facing verification experience — government ID capture, selfie, and any other configured steps. No PII is returned to your frontend; the widget only surfaces a completion signal.
Prerequisites
Before rendering the widget, your server must have already created a Relay session and returned a relay-session-access-token to your frontend. See the server-side integration methods for how to do this.
Rendering the widget
Install
Available on npm: @persona/relay
npm
yarn
Add a container element
Add a div to your HTML where the widget will be rendered.
The first argument accepts either a CSS selector string or a direct DOM element reference:
Initialize
During this step:
- The widget renders the configured verification experience (e.g. government ID + selfie)
- The user completes the flow entirely within the widget
- No PII is returned to your frontend —
onCompleteonly signals that verification is done
Once onComplete fires, retrieve the claim result from your server using the relay token and relay secret obtained during session creation.
Cleanup
Call client.destroy() to unmount the widget and clean up resources when it’s no longer needed.

