Vouchmark object. Use it when you don’t have a framework or want the simplest possible integration.
Installation
Add the script to your page’s<head> or before the closing </body>:
Quick start
Configuration options
| Parameter | Type | Required | Description |
|---|---|---|---|
widgetId | string | Yes | The widget ID from your dashboard. Must match the widget’s environment. |
publicKey | string | Yes | Publishable key: test_pk_… (sandbox) or live_pk_… (live). |
environment | "sandbox" | "live" | Yes | "sandbox" with test_pk_…, "live" with live_pk_…. Must match the widget ID. See Environments. |
applicant | object | No | Pre-fill applicant details (email, businessName, registrationNumber, phone, tin, jurisdiction, industry). |
referenceId | string | No | Your internal reference to link this session to your system. |
sessionToken | string | No | Server-generated signed token (required when requireSignedRequests is enabled). |
locale | string | No | UI language. Default "en". |
onSuccess | function | No | Called when the applicant is approved. Receives the applicant object. |
onAbandon | function | No | Called when the user closes the widget without completing. |
onError | function | No | Called on unrecoverable errors. Receives { code, message }. |
onStepCompleted | function | No | Called after each module completes. Receives { moduleId, status }. |
onReady | function | No | Called when the widget iframe has loaded and is ready. |
Methods
Vouchmark.open(config)
Opens the widget overlay. If the widget is already open, this is a no-op.
Vouchmark.close()
Programmatically closes the widget. Triggers onAbandon if the flow was not yet complete.
Vouchmark.isReady()
Returns true once the script has loaded and is ready to open.
Signed sessions (optional)
If you enabled Require signed requests in the widget security settings, you must generate asessionToken on your server before opening the widget:
