Skip to main content

Didit Web SDK Integration Reference: JS, Iframe, Redirect

Integrate the Didit web SDK in three steps: create a session on your server, pass its url to the SDK, then act on the signed webhook. $0.33 per full KYC check, SDK free.

Didit Web SDK Integration Reference: JS, Iframe, Redirect

Contents

In this guide

Jump to the part you need.

The Didit web SDK fits product teams that run identity checks in a browser app. You add one package, pass a session URL, and receive a signed status by webhook; a decision body rides along only for some statuses. A full KYC check is $0.33; the SDKs, workflow orchestrator and MCP server are free. The caveat: the redirect callback and the SDK's onComplete event only drive UI, so your server verifies the webhook.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

Didit web integration at a glance
ItemDetail
Package@didit-protocol/sdk-web
Server call to startPOST https://verification.didit.me/v3/session/
Result transportSigned webhook, or GET /v3/session/{session_id}/decision/
Price per full KYC check$0.33 (ID $0.15 + passive liveness $0.10 + face match $0.05 + device and IP $0.03)
SDK, workflow orchestrator, MCP serverFree
SandboxFree and unlimited on every plan
Typical setup timeDocumented setup estimates: 3 minutes for the JavaScript SDK, under 1 minute for the iframe

Which web method to choose

We document seven integration methods. Use a UniLink when you do not need to create a session on your server. Use the session API when your backend needs to create and correlate individual sessions.

Didit web integration methods
MethodSetup timeBackendBest for
JavaScript SDK3 minutesOptionalReact, Vue, Angular, Next.js, Nuxt, Svelte and vanilla JS with full programmatic control
InContext (iframe)Under 1 minuteOptionalEmbedding the flow without a redirect and without a build step
Redirect5 minutesYesMaximum browser compatibility and cross-device flows
WebView (iOS and Android)15 minutesYesMobile fallback when no native SDK is in the app
WordPress and WooCommerce5 minutesNo codeWordPress sites and WooCommerce stores
Shopify5 minutesNo codeShopify checkout or account verification
Salesforce10 minutesNo codeContact and Lead record verification in the CRM

For production web apps we recommend the JavaScript SDK. Use the iframe when you want the fastest embed, Redirect when the flow has to survive across devices, and the platform plugins if you live inside WordPress, Shopify or Salesforce. All three main web methods support cross-device verification, and we recommend Redirect when it is a priority. They deliver the final signed status by webhook. The comparison above describes the in-browser experience only, not how the decision reaches your server.

Prerequisites

What you need before the first session
RequirementDetailWhere
PlanFree at $0.00 a month, with $10.00 in monthly credit for the first organization created with an eligible work email for a company domain. Growth at $99.00, Scale at $299.00, Enterprise from $15,000 a yearPricing page
OrganizationCreated at sign-up, holds workflows, keys and verification activitybusiness.didit.me
API keySent as the x-api-key header on every verification callConsole, Settings, API & Webhooks
Webhook secretThe secret_shared_key returned when you register the destination, used to compute the HMAC signature you compare againstPOST /v3/webhook/destinations/, step 6
WorkflowDefines the steps the user goes through, and its UUID is required on every sessionConsole, Workflows
ClientA browser with camera accessYour app
Permissionsread:sessions on the key if you call the decision endpoint, and the iframe allow list if you embedKey settings and iframe markup

Setup, step by step

Step 1: Create the organization and copy the API key

Go to business.didit.me, create or select your organization, then open Settings and API & Webhooks. Copy the API Key and store it as DIDIT_API_KEY. The webhook secret is not created here; you store it when you register the destination in step 6. If you would rather not use a browser, register programmatically with POST https://apx.didit.me/auth/v2/programmatic/register/ followed by POST https://apx.didit.me/auth/v2/programmatic/verify-email/ and the 6-character code. The response carries a sandbox key you can build against for free, and a live key for production.

Step 2: Build a workflow and copy its ID

In the console go to Workflows and click Create Workflow. Pick the KYC template for full identity verification with an ID document, or Adaptive Age Verification, Biometric Authentication or Address Verification. Then add the features you need: NFC Verification, Liveness Detection, Face Matching, Phone Verification, Email Verification, AML Screening, Database Validation, Device and IP Analysis. Copy the Workflow ID. It is a stable UUID used on every session you create.

Step 3: Create a session from your server

Sessions are created server side so the API key never reaches the browser. The workflow type decides whether a user or a business session is created, there is no separate endpoint for KYB.

curl -X POST https://verification.didit.me/v3/session/ \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "workflow_id": "your-workflow-id",
    "callback": "https://yourapp.com/verification-complete",
    "vendor_data": "user-123"
  }'

The response is 201 Created and contains session_id, session_number, session_token, url and status set to Not Started. The url is what the browser opens. If your application has allowed domains set, an http or https callback must be on one of those origins, otherwise creation fails with 400 and the message names the allowed origin. Custom schemes such as myapp:// are always accepted.

Step 4: Add the JavaScript SDK and start the flow

The package is @didit-protocol/sdk-web. Installation instructions are in the JavaScript SDK guide. Then wire the completion callback and start verification with the url from step 3. Replace the sample hosted URL below with the url that Create Session returned. The callback gives you three cases: completed, cancelled and failed.

import { DiditSdk } from '@didit-protocol/sdk-web';

DiditSdk.shared.onComplete = (result) => {
  switch (result.type) {
    case 'completed':
      console.log('Session ID:', result.session?.sessionId);
      console.log('Status:', result.session?.status);
      break;
    case 'cancelled':
      console.log('User cancelled verification');
      break;
    case 'failed':
      console.error('Verification failed:', result.error?.message);
      break;
  }
};

// url comes from the Create Session response
DiditSdk.shared.startVerification({
  url: 'https://verify.didit.me/session/3FaJ9wLqX2Mz'
});
A user walking through the hosted Didit verification screens: document capture, then selfie, then processing
What the user sees after the SDK opens the session URL. The browser handles capture, the server handles the decision.

The in-browser callback is a user-experience signal. Treat it as a reason to show a spinner or a thank-you screen, never as the verification decision. Act on the status from a verified session webhook. A decision body can accompany Approved, Declined, In Review or Abandoned. Fetch the full record from the decision endpoint when you need it.

Step 5: Or present the session with an iframe or a redirect

The iframe route needs no backend for the flow itself. A UniLink can be built from your workflow ID in under a minute, or you can pass an API-created session URL.

<iframe
  src="https://verify.didit.me/u/YOUR_WORKFLOW_ID_BASE64"
  style="width: 100%; height: 700px; border: none;"
  allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
></iframe>

Include the full documented allow attribute so the embedded flow can request the permissions it needs.

Redirect is the fallback when a browser policy blocks embedded capture, or when the flow has to continue on another device. Your backend creates the session as in step 3, then sends the browser to the url it returned:

// verificationUrl is the url returned by the Create Session call
window.location.href = verificationUrl;

The browser leaves your app for the Didit-hosted page. When the user finishes, Didit redirects back to the callback URL you set on the session and appends verificationSessionId and status as query parameters, so your app can route the user from there.

Step 6: Register the webhook destination

Register a destination and store its returned secret_shared_key as DIDIT_WEBHOOK_SECRET. Retain the raw request body and verify the signature before processing the event.

curl -X POST https://verification.didit.me/v3/webhook/destinations/ \
  -H "x-api-key: $DIDIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Production",
    "url": "https://yourapp.com/api/webhooks/didit",
    "subscribed_events": ["status.updated", "data.updated", "user.status.updated", "user.data.updated"],
    "webhook_version": "v3"
  }'

Check that X-Timestamp is fresh: reject a delivery if it differs from the current time by more than 300 seconds. Decode the body only to produce sorted, Unicode-preserved canonical JSON, compute HMAC-SHA256 over that with your destination secret, and compare it with X-Signature-V2 in constant time before you process the event. X-Signature instead uses the exact raw bytes. Accept a match on X-Signature-V2-Previous too, verified with the replaced destination secret, so verification keeps working while a rotated secret is deployed. De-duplicate on event_id, and answer 2xx within 5 seconds. If your handler is slower, or answers 5xx or 404, we retry twice, after about 1 and 4 minutes, then drop the delivery. You can resend it from the destination's delivery log.

There is no wildcard. Subscribe to each event family you want. You can create multiple destinations to fan out to different URLs. The decision object is included on Approved, Declined, In Review and Abandoned.

Step 7: Read the full decision when you need it

curl https://verification.didit.me/v3/session/SESSION_ID/decision/ \
  -H "x-api-key: $DIDIT_API_KEY"

The response is the same shape as the webhook decision. Always branch on session_kind, which is user or business. Per-feature data lives in plural arrays, and if a feature did not run on the session the field is absent or null, never a placeholder.

  • User sessions: id_verifications[], nfc_verifications[], liveness_checks[], face_matches[], poa_verifications[], database_validations[].
  • Business sessions: registry_checks for the company, its officers, beneficial owners and ownership structure, key_people_checks for officers, beneficial owners, submitted parties and the UBO KYC summary, and document_verifications.
  • Shared by both kinds: aml_screenings[], phone_verifications[], email_verifications[], ip_analyses[], questionnaire_responses, document_ai_documents and bank_verifications[].

The endpoint needs the read:sessions privilege.

A session overview in the Didit Business Console with its status and warnings
The same session in the console: status, warnings and the feature results your decision endpoint returns.

Field and event mapping

Didit web SDK fields and events, mapped to what your app does with them
Field or eventWhere it appearsWhat you do with it
session_idCreate response, webhook envelope, decision responseUse it to correlate the session, webhook and decision response
session_tokenCreate response, inside the hosted URLIdentifies the flow. It is not a decision
urlCreate responsePass to DiditSdk.shared.startVerification({ url }), or use it as the iframe src or the redirect target
vendor_dataYou send it, we echo it in webhooksJoin the event to your own user record, also used for duplicate detection
metadataYou send it, echoed backInternal flags such as plan or signup source, never shown to the user
callbackYou send itWe append verificationSessionId and status so you can route the user back
statusSession, webhook, decisionApproved, Declined, In Review, In Progress, Not Started, Expired, Abandoned, Kyc Expired, Resubmitted, Awaiting User. Inspect it in the webhook, then call the decision endpoint when you need the full record
status.updatedWebhook webhook_typeThe session status changed. A decision object rides along only for Approved, Declined, In Review and Abandoned
data.updatedWebhook webhook_typeVerification data was edited, re-read the decision
user.status.updatedWebhook webhook_typeUser entity moved to ACTIVE, FLAGGED or BLOCKED
environmentWebhook envelopesandbox or live, the field that separates test traffic from production
X-Signature-V2, X-TimestampWebhook headersRetain the raw body and check X-Timestamp for freshness. Decode the body only to produce sorted, Unicode-preserved canonical JSON for X-Signature-V2. Compare signatures in constant time before processing the event. During rotation, verify X-Signature-V2-Previous with the replaced destination secret. X-Signature uses the exact raw bytes.
event_idWebhook envelopeDe-duplicate repeated deliveries
session_kindDecision responseBranch between the user and business handlers
result.typeSDK onCompletecompleted, cancelled or failed. UI only

Test with sandbox data

The sandbox is free and unlimited on every plan, and sandbox applications are separate from live ones. Two things make tests repeatable: the scenario catalog and the arm endpoint.

  • GET /v1/sandbox/scenarios/ lists the scenario slugs available to your sandbox application.
  • sandbox_scenario on session creation, for example approve or decline_aml_hit, expands the scenario's magic values onto contact and expected details so the session reproduces that outcome.
  • POST /v3/session/{session_id}/sandbox/arm/ arms or re-arms a scenario after creation, as long as the session is still Not Started.
  • The webhook's environment field tells sandbox from live. Use sandbox_scenario to identify an armed scenario when one is present, because an unarmed sandbox session can carry a null scenario slug.

Expected success path: create a session with sandbox_scenario set to approve, open the url, and finish the flow. For the approval test, check the signed Approved status and inspect results for the steps the workflow ran. Then confirm that GET /v3/session/{session_id}/decision/ returns the same shape. For decline_aml_hit, specify a sandbox workflow with AML screening and verify that the application takes its declined branch instead of marking the user verified.

Error cases and fixes

Common web integration failures
SymptomCauseFix
403 with detail You do not have permission to perform this actionThe x-api-key header is missing on a verification callSend the header on every authenticated verification API request
401The key is wrong, revoked or expiredCopy the current key from Settings, API & Webhooks
400 on session creationInvalid workflow_idUse the UUID from the workflow, not its label
400 naming allowed domainsThe callback origin is not on the application's allowed domainsAdd the origin, or use a custom scheme deep link
400 on session_expiration_timeThe value is outside 3600 to 2419200 seconds, or not a whole numberUse an integer inside the range, or omit the field
400 on sandbox_scenarioA scenario sent to a live applicationSend scenarios only with a sandbox key
404 on the decision endpointThe session does not exist or belongs to another applicationCheck that the session ID exists and that the API key belongs to the application that created the session
403 on the decision endpointThe key lacks read:sessionsGrant the privilege to the key
Camera error inside the iframeThe allow attribute is missing or incomplete, one of several possible causesInclude the full list from step 5. If the browser policy blocks embedded capture, use the Redirect method instead
Webhook delivery fails or retries stopWe retry twice if the handler takes longer than 5 seconds or returns a 5xx or 404 response. The retries occur about 1 and 4 minutes later. If both fail, the delivery is droppedOpen the destination's delivery log, resend, and answer 2xx within 5 seconds
Webhook signature mismatchThe destination secret is wrong, or the canonical JSON you signed differs from oursCheck the X-Signature-V2 secret and the canonical JSON. If you verify X-Signature instead, it needs the exact raw bytes. Validate signature and timestamp before any application processing

Disconnect and rotate

To disconnect the web flow, stop creating sessions and remove the SDK launch, iframe or redirect from your app.

The destination signing secret can be rotated in the console. For 24 hours after a rotation, we also send X-Signature-V2-Previous, verified with the replaced destination secret, so you can deploy the new secret and accept a match on either header while both are live.

Web KYC pricing and billing

You pay per completed check from prepaid credit, and nothing for the integration itself. The SDK, the workflow orchestrator, the MCP server and reusable KYC carry no price. Sandbox testing is free and unlimited.

Published unit prices that matter for a web KYC flow
LinePriceUnit
Full ID check (KYC)$0.33completed check
ID verification$0.15check
Passive liveness$0.10check
Face match 1:1$0.05check
Device and IP analysis$0.03check
AML screening, if you add the step$0.20check
NFC chip reading, add-on$0.15check
Phone verification$0.02 Didit fee + carrier chargecode

Free plan credit does not cover phone verification codes. Only the $0.02 Didit fee takes the plan discount, and the carrier charge passes through at cost.

An explainer screen about Didit credits, auto-recharge and volume discounts
Billing runs per completed check from prepaid credit. Plan credit is added monthly and does not roll over.

Worked cost example

The example is in USD. It uses the monthly plan fees, the full monthly credit and no existing top-up balance. Take a web app that completes 5,000 full KYC checks in a month, with no AML step.

  • Free plan, for an eligible organization with its full monthly credit available: 5,000 multiplied by $0.33 equals $1,650.00. Monthly credit of $10.00 is applied first, so top-ups come to $1,640.00 and the plan fee is $0.00.
  • Growth at $99.00 a month with 4% off every Didit price: 5,000 multiplied by $0.3168 equals $1,584.00. Credit of $115.00 is applied, so top-ups come to $1,469.00. Add the $99.00 fee and the month costs $1,568.00.
  • Scale at $299.00 a month with 10% off: 5,000 multiplied by $0.297 equals $1,485.00. Credit of $350.00 is applied, so top-ups come to $1,135.00. Add the $299.00 fee and the month costs $1,434.00.

Add an AML screening step at $0.20 per check and 5,000 checks add $1,000.00 at list price, or $960.00 on Growth and $900.00 on Scale.

Sources

Next step: create a free organization at business.didit.me, copy a sandbox API key and run one session end to end. The sandbox costs nothing, and no sales call is required to start.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Frequently asked questions

What is the Didit web SDK?

It is the client-side package that opens a Didit verification session inside your web app. The package is @didit-protocol/sdk-web and it supports React, Vue, Angular, Next.js, Nuxt, Svelte and vanilla JavaScript, with TypeScript types and modal or inline modes. The SDK handles the browser experience. For API-created sessions, your server creates the session and acts on the status from a verified webhook. The SDK can also open a UniLink without a session-create call from your server.

How much does a Didit web verification cost?

A full KYC check is $0.33, made up of ID document verification at $0.15, passive liveness at $0.10, face match at $0.05 and device and IP analysis at $0.03. The SDK, the workflow orchestrator and the MCP server are free, and sandbox testing is free and unlimited on every plan. Billing is per completed check from prepaid credit.

Do I need a backend to use the Didit JavaScript SDK?

You can pass a UniLink directly to the JavaScript SDK's startVerification method without creating an API session. For API-created sessions, keep the API key on your server and act on the status from a verified session webhook. A decision body can accompany Approved, Declined, In Review or Abandoned. Fetch the full record from GET /v3/session/{session_id}/decision/ when needed.

Which package do I install for React or Next.js?

Install @didit-protocol/sdk-web for verification, following the JavaScript SDK guide. Sign-in is a different product with different packages: @didit-protocol/auth, @didit-protocol/auth-react and @didit-protocol/auth-nextjs. For end-user sign-in, use the separate Authentication guides.

How do I verify a Didit webhook signature?

Keep the raw body. Recompute HMAC-SHA256 over the sorted, Unicode-preserved canonical JSON using your destination secret, and compare it with X-Signature-V2 in constant time before you process the event. Reject deliveries where X-Timestamp differs from the current time by more than 300 seconds. If you verify X-Signature instead, it uses the exact raw bytes. During secret rotation, also accept a match on X-Signature-V2-Previous, which is sent for 24 hours after rotation and is verified with the replaced destination secret.

What is the difference between the callback and the webhook?

The hosted page's redirect callback sends the user's browser back to your app with verificationSessionId and status in the query string, and the SDK's onComplete event does the same job inside the page. Both are convenient for routing, and neither is proof. A verified session webhook reports the status, and its decision object is included for Approved, Declined, In Review and Abandoned.

How do I test a declined verification in the sandbox?

Create the session with sandbox_scenario set to a decline slug such as decline_aml_hit, or arm the scenario afterwards with POST /v3/session/{session_id}/sandbox/arm/ while the session is still Not Started. The webhook's environment field separates sandbox from live, and sandbox_scenario names the armed scenario when one is present. Sending a scenario to a live application returns 400.

Why does my iframe show a camera error?

A missing or incomplete allow list is one possible cause: the frame cannot reach the camera and microphone without it. Add the full list: camera, microphone, geolocation, clipboard-write, fullscreen, autoplay, encrypted-media and digital-credentials-get. If the browser policy blocks embedded capture entirely, use the Redirect method instead.

Why does session creation return 400 with a message about allowed domains?

Your application has allowed domains configured and the callback origin is not one of them. The check compares scheme, host and port, so add the exact origin or switch to a deep link scheme such as myapp://, which is always accepted. A workflow default callback that sits outside the allowed domains is not used for the redirect.

Can an AI coding assistant set up the Didit web SDK for me?

Yes. The integration prompt is written for coding agents and covers the SDK choice, webhook HMAC verification and decision parsing. We also offer a free hosted MCP server at https://mcp.didit.me/mcp with OAuth sign-in. The MCP server carries no price.

How fast is the verification decision?

Inference runs at a sub-2-second p99. End-to-end timing also depends on user capture and whether the session enters In Review. We send a webhook when the session status changes. If your handler takes longer than 5 seconds to answer, the delivery counts as failed.

A lesson screen explaining how to use Didit with MCP from an AI client
If you would rather generate the integration from an assistant, the MCP route works alongside the SDK.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.