Skip to main content

Add Didit Identity Verification to React (2026 Guide)

Use @didit-protocol/sdk-web in React, create the session on your server with POST /v3/session/, then take the decision from a signed webhook. A full KYC check costs $0.33 and the sandbox is free.

Add Didit Identity Verification to React (2026 Guide)

Contents

In this guide

Jump to the part you need.

Our JavaScript verification SDK supports React. Install @didit-protocol/sdk-web, create the session on your server with POST /v3/session/, then read the final decision from a signed webhook or the authenticated decision endpoint. A completed full KYC check costs $0.33 at list price, and the sandbox is free. It fits React and Next.js teams that want the flow in their own UI. The caveat: session creation and the authoritative decision stay server-side; the browser receives the session URL and can see a status.

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

React identity verification with Didit at a glance

What a React integration with Didit involves
ItemDetail
Browser package@didit-protocol/sdk-web, with modal and inline modes
Frameworks coveredReact, Next.js, Vue, Angular, Nuxt, Svelte and vanilla JavaScript
Setup timeAbout 3 minutes for the SDK, before your own wiring
BackendOptional for the SDK. UniLink is the documented option without an app backend. Creating API sessions and receiving webhook decisions in this walkthrough needs a server.
Create a sessionPOST https://verification.didit.me/v3/session/
Read the decisionGET https://verification.didit.me/v3/session/{session_id}/decision/
Price per completed full KYC$0.33 list, $0.3168 on Growth, $0.297 on Scale
SandboxFree on every plan, 500 session creates per 24 hours per sandbox application
Coverage on record4,000+ companies, 220+ countries and territories, 14,000+ document types

The SDK handles the browser flow only. A verification session is a server object: your key creates it, Didit runs the checks and the final status arrives on a signed webhook and in the authenticated decision endpoint. Treat the browser callback as a user-experience signal and the webhook as the record.

Prerequisites before you write code

What you need in place first
RequirementWhy it mattersWhere it lives
A Didit account and an organizationHolds workflows, API keys and every sessionbusiness.didit.me
A published workflowPOST /v3/session/ requires a workflow_id, and the workflow type decides whether the session is a user or business verificationWorkflows in the Business Console
An API keySent as the x-api-key header on server calls. Keep it on the server and out of the client bundleYour organization in the Business Console
The read:sessions privilegeThe decision endpoint returns 403 without itKey permissions
A server endpoint you controlCreates the session and receives webhooks, so the key never ships in the bundleYour app
A webhook destinationSigned decisions in real timePOST https://verification.didit.me/v3/webhook/destinations/
A planFree is $0 a month. The first Free organization created with an eligible company-domain work email receives $10 of credit a month; phone codes are excluded. Growth is $99 a month, Scale is $299 a month, and Enterprise is from $15,000 a yeardidit.me/pricing

Two integration choices: JavaScript SDK or hosted redirect

Pick the JavaScript SDK for the flow inside your React app, or use the hosted redirect when you want the browser to leave your page. You can use the iframe route when you need an embedded screen. The public repository includes React examples.

  • JavaScript SDK. Install @didit-protocol/sdk-web and read the JavaScript SDK guide plus the SDK web examples. This is the route we recommend for production web apps because you get event callbacks and control over the flow.
  • Hosted redirect. Create the session with curl and redirect the browser to the returned url. The redirect guide covers it, and the embedded route is documented in InContext.

Add Didit to React in seven steps

  1. Create the account and the organization. Sign up at business.didit.me with SSO or email and password, then create your organization. Every workflow, key and session lives there.
  2. Build the workflow. Open Workflows in the sidebar, click New workflow, choose Verifying users, then either Describe it, Start from a template (KYC for standard onboarding) or Start empty. Publish it and copy the workflow UUID. A Simple workflow runs its steps in a fixed order; a node-based one branches on results.
  3. Register the webhook destination. Send the destination once, then store the returned secret_shared_key as an environment secret. Subscribe this handler to status.updated for the walkthrough. GET /v3/webhook/destinations/{destination_uuid}/ returns the secret again if you lose it.
    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://myapp.com/api/webhooks/didit", "subscribed_events": ["status.updated"], "webhook_version": "v3"}'
    There is no wildcard, so add other event families only if you handle them.
  4. Verify the signature and apply the status. Read the raw request body before parsing JSON, check that X-Timestamp is within 300 seconds of now, recompute HMAC-SHA256 over the sorted, Unicode-preserved canonical JSON with the destination secret, and compare it with X-Signature-V2 in constant time. Accept a constant-time match on either header. Check X-Signature-V2 with the current secret and, when the previous header and secret are available, check X-Signature-V2-Previous with the previous secret. In the handler, check webhook_type equals status.updated before applying status to the session whose session_id matches. The decision object is present for Approved, Declined, In Review and Abandoned. De-duplicate on event_id, answer 2xx within 5 seconds, and use the authenticated decision endpoint when you need the current decision.
  5. Create the session from your backend. One call, with your key on the server and never in the browser bundle. Replace YOUR_WORKFLOW_UUID with the workflow UUID from the Workflows page before you run the command:
    curl -X POST https://verification.didit.me/v3/session/ -H "x-api-key: $DIDIT_API_KEY" -H "Content-Type: application/json" -d '{"workflow_id": "YOUR_WORKFLOW_UUID", "vendor_data": "user-42", "callback": "https://myapp.com/kyc/return"}'
    The response contains session_id, url and session_token. Return the url to the browser.
  6. Install the SDK and start the flow. Run npm install @didit-protocol/sdk-web, then wire two things in a client component: the onComplete handler and a call to startVerification with the url from step 5.
    import { useEffect, useRef } from 'react';
    import { DiditSdk } from '@didit-protocol/sdk-web';
    
    export function VerifyButton({ sessionUrl }) {
      const buttonRef = useRef(null);
    
      useEffect(() => {
        const button = buttonRef.current;
        if (!button) return;
    
        function handleClick() {
          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;
            }
          };
          DiditSdk.shared.startVerification({ url: sessionUrl });
        }
    
        button.addEventListener('click', handleClick);
        return () => button.removeEventListener('click', handleClick);
      }, [sessionUrl]);
    
      return <button ref={buttonRef}>Verify identity</button>;
    }

    The effect runs when the component mounts and again whenever sessionUrl changes. Clicking the button attaches the onComplete handler with the result switch and then calls DiditSdk.shared.startVerification({ url: sessionUrl }), where sessionUrl arrives as a prop from your server. The cleanup removes the click listener, and nothing runs at module scope. The result type is one of completed, cancelled or failed. In a Next.js App Router project, keep this component on the client side, because the SDK opens the flow in the browser.

  7. Keep the decision call for the current decision. GET /v3/session/{session_id}/decision/ returns the current decision object. Branch on session_kind before you read feature fields, because a business session returns registry arrays and a user session returns identity arrays. The webhook decision object is present for Approved, Declined, In Review and Abandoned.

    Set DIDIT_SESSION_ID to the session_id returned in step 5, then run:

    curl "https://verification.didit.me/v3/session/${DIDIT_SESSION_ID}/decision/" -H "x-api-key: $DIDIT_API_KEY"
Walkthrough of the screens a person sees during a Didit KYC check
The hosted flow your React component opens: document capture, face capture and the result screen.

Field and event mapping

Didit fields and events across React and your server
Didit field or eventWhere it appearsHow your app uses it
workflow_idBody of POST /v3/session/Include the workflow UUID in the server's create-session request
vendor_dataRequest body, echoed in the webhookPass your own user id so the decision reaches the right record
callbackRequest bodyReturn URL. Didit appends ?verificationSessionId={session_id}&status={status}
urlCreate-session responsePass it as the url field in startVerification({ url: sessionUrl })
result.typeonCompleteRoute the UI on completed, cancelled or failed
result.session?.sessionId, result.session?.statusonCompleteUpdate local state, then wait for the signed webhook before you grant access
status.updatedWebhook, webhook_typeThe authoritative status: Approved, Declined, In Review, In Progress, Not Started, Expired, Abandoned, Kyc Expired, Resubmitted or Awaiting User
event_idWebhook envelopeIdempotency key for your handler
environmentWebhook envelopeCheck environment before writing records and route sandbox events to test records
session_kindDecision objectBranch between user and business before reading feature arrays
id_verifications[], liveness_checks[], face_matches[], aml_screenings[]Decision objectThe decision uses plural fields for checks that ran. A field can be absent or null when its check did not run

Test with sandbox data

A sandbox application is a per-application mode, the same idea as test mode on a payment processor. Every external provider is mocked, sessions are never billed, the balance check is bypassed and the per-application quota is 500 session creates per 24 hours. Liveness still runs for real, so the capture experience you test is the one your users get.

Create a session with sandbox_scenario in the body to reproduce an outcome. The scenario slugs come from GET /v1/sandbox/scenarios/, read with the same x-api-key. If the session is still Not Started, you can arm or re-arm it with POST /v3/session/{session_id}/sandbox/arm/. Webhooks from the sandbox carry "environment": "sandbox" and the armed slug in sandbox_scenario.

Use specimen documents. Outcomes never depend on the pixels, but captured media is stored for real, exactly like a live session.

Sandbox outcomes to test in React
ScenarioWhat the signed status saysWhat the app should do
ApprovedApprovedGrant access only after the signed webhook or decision call confirms Approved
DeclinedDeclinedShow the next step. Assert the Declined status; do not assume a reason field
In ReviewIn ReviewShow a waiting state and do not grant access

Expected success. For an approval scenario, assert that the signed status.updated event reports Approved. Test the SDK completion callback separately. Your app should grant access only after the signed webhook or authenticated decision endpoint confirms Approved.

Expected failure shapes. A decline scenario comes back as Declined, not as an HTTP error. A review scenario comes back as In Review and shows up in the console for a person to look at. Your React code should treat all three outcomes as normal answers, not as exceptions.

The face capture step shown to a person during a Didit liveness check
Face capture runs for real in the sandbox. Only the result is simulated.

Error cases and fixes

Common failures when adding Didit to React
SymptomLikely causeFix
403 {"detail": "You do not have permission to perform this action."} on verification.didit.meMissing API key, or the key lacks read:sessionsSend the x-api-key header and check the key's privileges
401Wrong, revoked or expired keyIssue a new key and redeploy
400 on workflow_idThe workflow id is not a valid UUID for this applicationCopy the UUID from the Workflows page of the same organization
400 on callbackThe URL is not on the application's allowed domainsAdd the callback origin to allowed_domains, or omit callback and use a workflow default that meets the application's allowed-domain rules
404 {"detail": "Not found."}The session does not exist or belongs to another applicationCheck that session_id and the key come from the same application
Webhook delivery failsThe handler answered 5xx or 404, or took longer than 5 secondsDidit retries twice, after about 1 and 4 minutes, then drops the delivery. Resend it from the destination's delivery log
Signature check fails after rotationThe destination signing secret may have rotatedCompare in constant time using the current secret with X-Signature-V2 and the previous secret with X-Signature-V2-Previous when available. Didit sends the previous signature for 24 hours after rotation
The iframe shows no cameraThe allow attribute is missingInclude allow="camera; microphone; geolocation; clipboard-write; fullscreen; autoplay; encrypted-media; digital-credentials-get"
The liveness result stored on a session in the Didit Business Console
The Business Console shows the liveness result for this session.

Disconnect Didit from your React app

On the application side, remove the SDK call from your component and remove @didit-protocol/sdk-web from your dependencies. Check whether the Didit webhook destination still points at the endpoint you plan to retire. If it returns HTTP 404, Didit retries delivery twice before dropping it.

What React identity verification costs, on both ends

The browser end is free. The SDK, Workflow Orchestrator and MCP server are free. The Didit end is paid per completed check, drawn from prepaid credit, and the sandbox never bills.

Worked example at 5,000 completed full KYC checks in a month, using only published unit prices.

  • List price: 5,000 × $0.33 = $1,650.00.
  • Scale unit price: 5,000 × $0.297 = $1,485.00.
  • Scale credit is $350 a month for the $299 fee, so the top-up you need is $1,485.00 - $350.00 = $1,135.00.
  • Monthly payment at this volume: $299.00 + $1,135.00 = $1,434.00. The Scale example assumes all $350.00 of monthly credit is available, the full volume falls in one billing month, and there is no existing top-up balance. That is $216.00 less than the $1,650.00 gross list-price usage.
  • Add AML screening and the check becomes $0.53 per completed check, which is $0.33 for full KYC plus $0.20 for AML screening: 5,000 × $0.53 = $2,650.00 at list.
  • A Free organization that qualifies receives $10.00 of credit each month, so the first $10.00 of usage is covered. The $10 applies to the first Free organization created with an eligible company-domain work email; phone codes are excluded.

For full KYC, Growth is $99 a month with $115 of credit and a discounted rate of $0.3168 per check; Scale is $299 a month with $350 of credit and $0.297 per check. Plan discounts have published exceptions, including transaction monitoring beyond the plan allowance. Credit resets monthly and does not roll over, while top-ups last 12 months. Enterprise starts at $15,000 a year.

Sources

Start in the sandbox with no sales call: create your organization at business.didit.me, build a KYC workflow, create one session and watch the webhook arrive before you touch production.

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

Is there an official Didit SDK for React?

Yes. The JavaScript SDK is published as @didit-protocol/sdk-web and the documentation lists React, Next.js, Vue, Angular, Nuxt and Svelte support, with React examples in our public repository. It supports modal and inline modes plus event callbacks. It is separate from the authentication packages @didit-protocol/auth and @didit-protocol/auth-react, which handle end-user sign-in.

How do I add identity verification to a React app with Didit?

Create a workflow in the Business Console, then create a session server-side with POST https://verification.didit.me/v3/session/ using your API key and the workflow UUID. Pass the returned url into DiditSdk.shared.startVerification({ url: sessionUrl }) inside a client component, and take the final status from the signed webhook or the decision endpoint. The key stays on the server.

Do I need a backend for React KYC integration?

The SDK docs list the backend as optional, and UniLink is the documented option without an app backend. In a React app you still want a server for creating API sessions and receiving webhook decisions, because the API key must not reach the browser and the authoritative decision arrives by webhook. A pattern that works: the client asks your server for a session URL, your server calls Didit, and your server receives the webhook.

How much does a React KYC check cost with Didit?

A full KYC check is $0.33 at list price, made 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 same check is $0.3168 on Growth and $0.297 on Scale. The SDK and the Workflow Orchestrator are free and the sandbox never bills.

How do I test a React Didit integration without real identity documents?

Create a sandbox application, then pass sandbox_scenario when you create a session, using a slug from GET /v1/sandbox/scenarios/. Every external provider is mocked, sessions are never billed and webhooks carry "environment": "sandbox". Liveness capture runs for real, so you test the actual screens. Use specimen documents because captured media is stored even though outcomes are simulated.

What is the difference between onComplete and the webhook in React?

onComplete fires in the browser and reports completed, cancelled or failed, which is enough to move the user to a waiting screen. Signed status.updated webhook events report status changes to your server, and the authenticated decision endpoint returns the current decision. Grant access only when the signed webhook or the authenticated decision endpoint reports Approved.

What should my React app do when the browser callback fires?

Use the callback to move the user to a waiting or result screen, then wait for the signed webhook. Didit appends ?verificationSessionId={session_id}&status={status}. The webhook decision object is present for Approved, Declined, In Review and Abandoned; use the authenticated decision endpoint when you need the current decision.

Which session statuses should my React UI handle?

The exact case-sensitive values are Approved, Declined, In Review, In Progress, Not Started, Expired, Abandoned, Kyc Expired, Resubmitted and Awaiting User. Note the single capital K in Kyc Expired. In Review and Awaiting User mean a person or the user still has to act, so show a waiting state rather than a failure.

How do I verify the Didit webhook signature in a React or Next.js app?

Read the raw body before parsing JSON, confirm X-Timestamp is within 300 seconds, then recompute HMAC-SHA256 over the sorted, Unicode-preserved canonical JSON with the destination's secret_shared_key and compare it to X-Signature-V2 in constant time. Compare in constant time using the current secret with X-Signature-V2 and the previous secret with X-Signature-V2-Previous when available. Didit sends the previous signature for 24 hours after a secret rotation. Answer 2xx within 5 seconds and de-duplicate on event_id.

Can an AI assistant build the Didit React integration for me?

A coding assistant with MCP support can connect to the Didit MCP server at didit.me/developers/mcp and use the official integration prompt at didit.me/developers/integration-prompt. The MCP server is free and hosted at https://mcp.didit.me/mcp with OAuth sign-in. Review the output against the docs before you ship.

Why does my create-session call return 400 on the callback URL?

When an application has allowed domains, any http or https callback must match one of those origins on scheme, host and port, otherwise creation fails with a 400 on callback. Add the callback origin to allowed_domains, or omit callback and use a workflow default that meets the application's allowed-domain rules. Custom app schemes such as deep links are always accepted.

Is there a separate endpoint for business verification in React?

No. POST /v3/session/ is a unified endpoint, and the workflow type decides whether the session is a user verification or a business verification. On the way back, branch on session_kind: user sessions return identity arrays, business sessions return registry_checks and key_people_checks.

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.