Skip to main content

Identity Verification in React: A Developer's Guide

Create a Didit session on your server, open the hosted flow from a React component with @didit-protocol/sdk-web, and read the decision from a status.updated webhook, with the decision endpoint as the fallback.

Identity Verification in React: A Developer's Guide

Contents

In this guide

Jump to the part you need.

This guide is for developers adding identity verification to a React or Next.js application. You create a session on your server, open Didit's hosted flow from a React component, and read the decision from a webhook. A full KYC check costs $0.33. The one caveat that decides your architecture: the API key stays on the server, so the browser only ever receives a session URL.

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

Didit identity verification in a React app at a glance
ItemWhat it is
Create a sessionPOST https://verification.didit.me/v3/session/ with a workflow_id, called from your server
Render the flow@didit-protocol/sdk-web, then DiditSdk.shared.startVerification({ url })
Get the decisionstatus.updated webhook, with GET /v3/session/{session_id}/decision/ as the fallback
Price per full KYC$0.33 per completed check
Free to startUnlimited sandbox, plus $10 of monthly credit on the Free plan for eligible work-email signups

Start free in the sandbox at business.didit.me, no sales call. If you would rather have a coding agent scaffold the calls, connect Didit to your assistant through the Didit MCP server and point it at the integration prompt. The Free KYC product and its price breakdown live on didit.me/products/free-kyc, and every unit price is on didit.me/pricing.

What you are building, and which React method to pick

The outcome is two pieces of code. A server route creates a verification session with your API key and returns the session URL to the client. A React component that hands the returned URL to the Didit SDK, opens the flow in a modal or inline, and shows progress to the user. The decision itself never comes from the browser.

Three documented ways to run Didit verification inside a React app
MethodSetup timeBackendBest for
JavaScript SDKAbout 3 minutesOptionalProduction React and Next.js apps that need event callbacks plus modal or inline control
InContext iframeUnder 1 minuteOptionalEmbedding without a redirect, or a UniLink when no backend exists yet
RedirectAbout 5 minutesRequiredCross-device flows and browsers where iframe camera access fails

We recommend the JavaScript SDK for production React work. It gives you the completion callback inside the app, TypeScript support from the package, and modal or inline layout control. All three methods deliver the final decision by webhook, so the method changes the user experience, not how you receive the verdict. The web SDK overview covers the full comparison.

Prerequisites

  • A Didit organization. Sign up at business.didit.me with a work email to receive $10 of monthly credit on the Free plan. Sandbox testing is free and unlimited.
  • An API key copied from the Console, kept in server environment variables. Sandbox and live keys are separate.
  • A verification workflow of type KYC. The KYC template is enough for a first run.
  • npm available to install @didit-protocol/sdk-web, and a React or Next.js project.
  • Implementation guidance from us: a public HTTPS endpoint for webhooks. While you test locally, use the decision endpoint instead and add the webhook before launch.

Step by step: identity verification in a React app

  1. Create the workflow. In the Console, open Workflows, click New workflow and pick the KYC template, or build it with the API and persist the returned workflow.id. The workflow decides which checks run, and you pay for the completed checks at the applicable module prices.

    curl -X POST https://verification.didit.me/v3/workflows/ \
      -H "x-api-key: $DIDIT_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "workflow_label": "Standard KYC",
        "workflow_type": "kyc",
        "features": [
          {"feature": "OCR"},
          {"feature": "LIVENESS", "config": {"face_liveness_method": "PASSIVE"}},
          {"feature": "FACE_MATCH"},
          {"feature": "AML"}
        ]
      }'

    The sample above includes AML, which changes the total from $0.33 to $0.53 per completed check: $0.33 for ID document, passive liveness, face match and device and IP analysis, plus $0.20 for AML screening. Remove the AML feature and the same workflow prices at $0.33.

  2. Create the session from your server. Run this in a Next.js route handler, an Express route or any Node process. Never call it from the browser, because the header carries your key. The response contains session_id, url and session_token.

    curl -X POST https://verification.didit.me/v3/session/ \
      -H "x-api-key: $DIDIT_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"workflow_id": "$WORKFLOW_ID", "vendor_data": "user-42", "callback": "https://myapp.com/kyc/return"}'

    Send only url to the client.

  3. Install the SDK and start the flow. Install with npm install @didit-protocol/sdk-web. Put the call in a named function so the component stays a plain view. This is the documented SDK call with the minimum glue around it:

    import { DiditSdk } from '@didit-protocol/sdk-web';
    
    export function startVerification(sessionUrl) {
      DiditSdk.shared.startVerification({ url: sessionUrl });
    }

    Register the completion callback once, when the app mounts:

    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;
      }
    };

    Your component renders a plain button, and the app's button handler calls startVerification(sessionUrl) with the url your server created. Nothing else in the browser needs the session id or the key.

    The completion callback is for interface state only: it tells you the modal closed and which status came back. Access decisions belong to the webhook or to GET /v3/session/{session_id}/decision/, because that is the signed result your server can trust. Runnable React, Next.js and Vue examples live in the sdk-web-examples repository.

    Didit hosted flow showing the ID document scan and the biometric selfie step
    What the user sees after your button handler calls startVerification with the session URL: ID document capture, passive liveness and face match in one flow.
  4. Register a webhook destination. Call POST https://verification.didit.me/v3/webhook/destinations/ with a label, a url and the events you want, for example status.updated, data.updated, user.status.updated and user.data.updated with webhook_version set to v3. Save the returned secret_shared_key as a server secret. You can read it again from the destination record if you lose it.

  5. Verify the signature before you trust the payload. Read the raw request body before any JSON parser touches it. Recompute HMAC-SHA256 over the sorted canonical JSON and compare it in constant time against X-Signature-V2, and against the -Previous header during a secret rotation. Reject the request if the X-Timestamp is more than 300 seconds away from now. De-duplicate on event_id and answer 2xx within 5 seconds.

  6. Read the decision, with the endpoint as a fallback. When the webhook includes a decision for Approved, Declined, In Review or Abandoned, your server can use it. Otherwise, fetch GET https://verification.didit.me/v3/session/{session_id}/decision/ with a key that holds read:sessions. Branch on session_kind first, because user and business sessions return different feature arrays.

  7. Map the status to your interface. Use strict equality against the exact strings. Approved grants access to the account, Declined shows the reason and offers support, In Review shows a pending state, and Resubmitted means the user must redo the requested steps before the session reaches a new decision.

Expected output

The create call returns a short object. The values below are illustrative, trimmed to the fields you use.

{
  "session_id": "<uuid>",
  "url": "https://verify.didit.me/session/<short-link>",
  "session_token": "<token>"
}

The decision response is longer. Trimmed to the keys you branch on, a KYC session looks like this. V3 feature fields are always plural arrays, and a feature that did not run is absent or null, never a placeholder.

{
  "session_id": "<uuid>",
  "session_kind": "user",
  "status": "Approved",
  "vendor_data": "user-42",
  "id_verifications": [ ... ],
  "liveness_checks": [ ... ],
  "face_matches": [ ... ],
  "aml_screenings": [ ... ]
}
Business Console session view showing the ID document check result
The ID document result in the Console, the first line of the $0.33 full KYC price.
Business Console session view showing the passive liveness result
Passive liveness is a separate array in the decision and a separate line in the bill.

Identity verification API: the three calls that matter

Every React integration reduces to three API calls. POST /v3/workflows/ defines the checks once. POST /v3/session/ starts one verification for one person and returns the hosted URL. GET /v3/session/{session_id}/decision/ returns the verdict with the per-feature evidence. Webhooks push the status change to you in real time, and for Approved, Declined, In Review or Abandoned they carry the decision object too, so most apps call the decision endpoint only when a delivery is missed.

Inputs and outputs

Fields you send and fields you read
FieldDirectionNotes
workflow_idIn, requiredUUID from the workflow call. The workflow type decides whether you get a KYC or a KYB session.
vendor_dataIn, recommendedYour stable user identifier. It is echoed on every webhook and used for duplicate detection.
callbackIn, optionalWhere the hosted flow returns the user. It must sit on one of your allowed domains when those are configured.
metadata, tags, languageIn, optionalEchoed back, used to filter sessions in the Console, and to set the flow language with an ISO 639-1 code.
expected_detailsIn, optionalName, date of birth and country you already hold. Mismatches surface as decision warnings.
urlOutPass it to startVerification. It is the only value the browser needs.
statusOutExact, case-sensitive string, for example Approved, In Review or Kyc Expired.
session_kindOutuser or business. Branch on it before reading any feature array.
id_verifications[], liveness_checks[], face_matches[], poa_verifications[]OutPlural arrays on V3. Absent or null when the step did not run.

Failure cases and recovery

What breaks, what it means, and what to do
SymptomCauseRecovery
403 with detail "You do not have permission to perform this action."The key is missing from the request, or it lacks the privilege the call needs.Check the header name and the key's privileges, then retry.
401The key is invalid, revoked or expired.Issue a new key in the Console and redeploy the secret.
400 on session creationBad workflow_id, or a callback outside your allowed domains.Reuse the stored workflow UUID, or add the callback origin to your allowed domains.
404 on the decision callThe session does not exist or belongs to a different application.Confirm you are using the key from the same application that created the session.
Webhook never arrivesYour handler took longer than 5 seconds, or answered 5xx or 404. Didit retries twice, about 1 and 4 minutes later, then drops the delivery.Answer 2xx immediately, process afterwards, and resend missed events from the destination delivery log.
Signature mismatchYou parsed and re-encoded the body, or the timestamp is stale.Hash the raw bytes, keep the canonical form intact, and reject anything older than 300 seconds.
Expired or AbandonedThe user never opened the link, or started and did not finish before the session lifetime ended.Create a fresh session. You can override the lifetime per session between 1 hour and 4 weeks.

Billing is per completed check from prepaid credit. A workflow that runs ID document, passive liveness, face match and device and IP analysis bills $0.15 + $0.10 + $0.05 + $0.03, which is the $0.33 full KYC price. Active liveness costs $0.15 per check if you require an active gesture instead of passive. AML screening is $0.20, which is why the sample workflow above lands at $0.53 per completed check. Proof of Address is $0.20, NFC chip reading is a $0.15 add-on, email verification is $0.02, phone verification is from $0.02 plus the carrier's price per code, and white label is $0.10 per check. The workflow orchestrator, the SDKs and the MCP server carry no fee. Some no-match database lookups and retries are billable, and the pricing docs list which ones.

Review is a separate boundary from billing. Automated checks decide most sessions. When warnings need a human, the session moves to In Review and a compliance reviewer approves, declines or requests a resubmission in the Console. The checks that ran are already billed at that point.

Worked cost example

Take 12,000 completed KYC checks in a month on the Growth plan, which costs $99 a month, comes with $115 of monthly credit, and takes 4% off every Didit price.

  • List price: 12,000 x $0.33 = $3,960.00.
  • Growth discount: $3,960.00 x 0.96 = $3,801.60.
  • Apply the $115 credit, then add the $99 plan fee: $3,801.60 - $115.00 + $99.00 = $3,785.60 for the month.

Add AML screening to every session and the arithmetic changes. The compliance bundle is $0.33 + $0.20 = $0.53 per check at list, so 12,000 x $0.53 = $6,360.00, then x 0.96 = $6,105.60, then - $115.00 + $99.00 = $6,089.60. Unused monthly credit does not roll over, and top-ups last 12 months.

Address verification for regulatory compliance

Address verification is a workflow step, not a separate integration. Add Proof of Address to the workflow and the decision returns a poa_verifications array next to the identity checks. It costs $0.20 per check. Teams use it when a regulation asks them to confirm where a customer lives, alongside AML screening at $0.20 per check. In React terms nothing changes: the same session URL drives the flow and the same webhook carries the result.

Proof of Address step asking the user to upload a utility bill or bank statement
Proof of Address runs inside the same session, at $0.20 per check.

Sources

Next step: create a free organization at business.didit.me, no sales call, create one sandbox session with the curl call above and watch the decision land in the Console. Then add the React component and the webhook to your app.

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

Alejandro Rosas

Co-founder and CTO

Alejandro Rosas

Alejandro Rosas

Co-founder and CTO

About Didit

Questions

Frequently asked questions

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

Create a KYC workflow, create a session server-side with POST https://verification.didit.me/v3/session/, then pass the returned url to DiditSdk.shared.startVerification from the @didit-protocol/sdk-web package. Read the final decision from your status.updated webhook or from the decision endpoint. A full KYC check costs $0.33.

Do I need a backend for identity verification in React?

To create a session through the API, yes, because the x-api-key header must stay on the server. If you have no backend yet, the documented InContext iframe supports a UniLink that needs no server at all. The redirect method also requires a backend.

What does a Didit KYC check cost in 2026?

$0.33 per completed check: $0.15 for ID document verification, $0.10 for passive liveness, $0.05 for face match and $0.03 for device and IP analysis. Add AML screening at $0.20 and the same session costs $0.53. Growth takes 4% off every price and Scale takes 10%.

Which statuses can a Didit verification session return?

Not Started, In Progress, Approved, Declined, In Review, Awaiting User, Resubmitted, Expired, Abandoned and Kyc Expired. They are exact, case-sensitive strings, and Kyc Expired uses a single capital K. Compare with strict equality in your React code.

How do I read the result in React without trusting the browser?

Use the webhook. The SDK completion callback only updates the interface, while your server receives status.updated. When the webhook includes a decision for Approved, Declined, In Review or Abandoned, your server can use it. Otherwise, fetch GET /v3/session/{session_id}/decision/. Access decisions follow the server result, never the browser callback.

Does the Didit JavaScript SDK work with Next.js and TypeScript?

Yes. The SDK is documented for React, Next.js, Vue, Angular, Nuxt, Svelte and vanilla JavaScript, with full TypeScript support and modal or inline modes. Example applications for each framework are published in the sdk-web-examples repository.

Can I use Didit in React Native?

The documented mobile route is the WebView method for iOS and Android, or a redirect, because the JavaScript SDK targets browser surfaces. The integration prompt also lists React Native as a supported surface. Either way, session creation stays on your server and the decision arrives by webhook.

How do I test identity verification in React without real documents?

The sandbox is free and unlimited. Sandbox applications accept a sandbox_scenario field on session creation that reproduces a specific outcome from the scenario catalog, so you can test Approved, Declined and In Review paths deterministically. Live applications reject that field with a 400.

How do I add address verification for regulatory compliance?

Add the Proof of Address step to your workflow. It costs $0.20 per check and returns a poa_verifications array in the decision, in the same session and the same webhook as the identity checks. Pair it with AML screening at $0.20 per check when the regulation requires both checks.

Why does my session creation return 403 or 400?

A 403 with "You do not have permission to perform this action." means the key is missing or lacks the privilege. A 401 means the key is invalid, revoked or expired. A 400 usually means a bad workflow_id or a callback URL outside your allowed domains.

Who decides a session that lands In Review?

A person. Automated checks route the session to In Review with warnings, and a compliance reviewer approves, declines or requests a resubmission in the Console. You are billed for the checks that ran, not for the reviewer's time.

Is the Didit MCP server part of the React integration?

No. It is a development aid that lets a coding assistant read the docs and scaffold the API calls, and it is free. Your application runtime talks to the verification API and receives webhooks.

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.