Overview
Instead of redirecting users to pawaPass, you can embed the verification flow directly in your application using the Web SDK. The SDK creates and manages a secure iframe, handles communication viapostMessage, and delivers results through callbacks. No cookies, no redirects, no sensitive data in your frontend.
Redirect (default)
User leaves your site, completes verification on pawaPass, returns via
successUrl / errorUrl.Iframe SDK
User stays on your site. Verification runs inside a managed iframe. You control the surrounding UX.
Installation
PawaPass object. The npm package provides a default ES module export. Zero runtime dependencies.
npm registry configuration
The@pawapass scope is hosted on a separate registry. To install the package with npm or pnpm, tell your package manager where to find the scope by adding this line to your .npmrc (in the project root, or ~/.npmrc for all projects):
.npmrc
npm install @pawapass/web-sdk and pnpm add @pawapass/web-sdk resolve the package normally. The CDN needs no configuration.
Quick start
1
Create a verification (server-side)
Your backend creates a verification and passes the returned
id (used as verificationId in the SDK) to the frontend. This keeps your API key on the server.2
Add a container element
3
Initialize the SDK
Configuration
string
required
Your public key for client identification. Safe to expose in frontend code. This is not your API key.The key format is
pk_{env}_{key} (e.g. pk_prod_abc123). The SDK automatically resolves the correct pawaPass environment from the key prefix, so no separate environment or URL configuration is needed.Contact us to obtain your public key.string
required
Verification ID obtained from your backend via the Create verification endpoint.
string
required
ID of the HTML element where the iframe will be mounted.
string
default:"en"
UI language. Supported:
en, rw, sw, pt, fr.boolean
default:"false"
When
true, stores a device identifier in localStorage for consistent analytics identity across sessions. When false (default), the device ID is stored in memory only and cleared on destroy().Callbacks
onReady
Fired when the iframe is loaded and ready. Use to show a “Start verification” button or hide loading spinners.onStart (optional)
Fired when the user begins the verification process. Use for analytics or logging.onComplete
Fired when the verification process finishes.Example result
REVIEW and USER_DATA_COLLECTED are not final statuses. The final result will arrive via webhook. No further user action is needed. The client-side flow is complete.onError
Fired on SDK-level errors. Verification errors (e.g. blurry document) are handled inside the iframe and do not trigger this callback.
Safe to retry
init() with the same verificationId. No need to create a new session.
onCancel
Fired when the user exits verification by clicking the “back” button.In a future release,
onCancel will include context about at which step the user decided to abandon the verification process.Cleanup
init() returns an instance. Keep the reference and call destroy() on it to remove the iframe and clean up all event listeners and timers:
init() again on the same container automatically destroys the previous instance.
Architecture
Content Security Policy
The SDK makes one request from the parent page to validate the public key and fetch partner configuration. The iframe handles all other network requests. If your site uses a Content Security Policy, add the following directives:
The
frame-src and connect-src domains are determined by your public key prefix:
