Gå til hovedindhold
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 docsCurrent 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 modelPrefer onDenied, onCancelled, and onError

Current mental model

The SDK now follows this structure:

  1. Call init() with config and callbacks
  2. Call either startVerificationWithRedirect() or startVerificationWithPopup()
  3. 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 targetOrigin handling
  • The current docs do not rely on the old mode flag pattern

Next step

Follow the current Installation guide

On this page