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.
Quick start
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.Configuration
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.Verification ID obtained from your backend via the Create verification endpoint.
ID of the HTML element where the iframe will be mounted.
UI language. Supported:
en, rw, sw, pt, fr.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
| Status | Meaning |
|---|---|
APPROVED | Verification successful |
DECLINED | Verification rejected |
REVIEW | Waiting for manual agent review |
USER_DATA_COLLECTED | User data submitted, processing verification |
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.| Error code | Description |
|---|---|
IFRAME_LOAD_FAILED | Iframe failed to load |
IFRAME_READY_TIMEOUT | Iframe did not respond within 15 seconds |
NETWORK_ERROR | Connection to pawaPass failed |
INVALID_PUBLIC_KEY | Public key not recognized |
INVALID_CONFIG | Invalid SDK configuration |
CONTAINER_NOT_FOUND | Container element not found in DOM |
ORIGIN_NOT_ALLOWED | Parent origin is not allowed for this partner |
FULLSCREEN_NOT_SUPPORTED | Browser does not support fullscreen mode for iframes |
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
Calldestroy() 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:| Directive | Value | Why |
|---|---|---|
script-src | https://cdn.pawapass.com | Loading the SDK via script tag |
frame-src | depends on key prefix | Verification iframe |
connect-src | depends on key prefix | Public key validation request |
frame-src and connect-src domains are determined by your public key prefix:
| Key prefix | Domain |
|---|---|
pk_prod_ | https://app.pawapass.com |
pk_{env}_ (e.g. pk_sandbox1_) | https://app.{env}.pawapass.com |
