JavaScript SDK
Migration
Migrate from the older SDK quickstart and outdated API names to the current SDK flow.
Migration
Older public SDK docs described an outdated API shape.
If you are updating an existing integration, use this page to map the old concepts to the current SDK.
What changed
| Older docs | Current SDK |
|---|---|
@unqtech/age-verification | @unqtech/age-verification-mitid |
start() | startVerificationWithRedirect() |
startWithPopup() | startVerificationWithPopup() |
mode: 'redirect' or mode: 'popup' | Choose the start function directly |
onFailure as the main error model | Prefer onDenied, onCancelled, and onError |
Current mental model
The SDK now follows this structure:
- Call
init()with config and callbacks - Call either
startVerificationWithRedirect()orstartVerificationWithPopup() - Process the result on the callback page with
handleRedirectResult()
Old vs new startup example
Old style
init({
mode: 'redirect',
onFailure: (error) => console.error(error),
})
start()Current style
init({
publicKey: 'pk_test_your_key',
ageToVerify: 18,
redirectUri: 'https://your-app.com/verification-result',
onVerified: (payload) => console.log(payload),
onDenied: (outcome) => console.warn(outcome.code),
onCancelled: (outcome) => console.warn(outcome.code),
onError: (outcome) => console.error(outcome.code, outcome.message),
})
startVerificationWithRedirect()About onFailure
onFailure still exists so older integrations keep working.
You can keep it during migration, but new logic should primarily use the granular callbacks.
Other corrected details
- The current docs describe the real package name on npm
- The current docs use the real exported function names
- The current docs explain popup
targetOriginhandling - The current docs do not rely on the old mode flag pattern