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.
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.
Install
Available on npm: @persona/relay
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:
onComplete only signals that verification is doneOnce onComplete fires, retrieve the claim result from your server using the relay token and relay secret obtained during session creation.
Call client.destroy() to unmount the widget and clean up resources when it’s no longer needed.