> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK 与集成：Web、移动端、Zapier 身份验证接入

> Didit 提供 Web、原生移动端和后端 SDK，支持 Python、Node.js、Go、Java、PHP、Ruby、.NET 及插件，快速将 KYC 身份验证集成到您的应用中。

> [!NOTE]
>
> 终端用户登录相关内容请参阅[认证](https://docs.didit.me/zh/authentication/overview.md)。要将验证、监控和登录结合起来，请使用[共享集成提示词](https://docs.didit.me/zh/integration/integration-prompt.md)。认证 SDK 的可用性与下方的验证 SDK 版本相互独立。

AI Agent Integration Prompt
        将提示词复制到剪贴板



      
      

\<pre>

\``I want to integrate Didit identity verification into my application. Analyze my project and recommend the best integration approach.

\## My Project Context
\[Describe your stack: framework, language, web vs mobile, etc.]

\## Two Integration Approaches

Didit offers two main integration approaches. Choose based on your use case:

\### Approach 1: SDK Integration via Sessions (RECOMMENDED)
Best for: User-facing verification flows (KYC onboarding, age verification, identity checks).
How it works: Your backend creates a session, your frontend presents a verification UI using an SDK, the user completes verification, and your backend receives results via webhook.
Why recommended: Didit-hosted verification flows are A/B tested and optimized for the highest completion rates, fastest speed, and best security. The SDKs handle camera permissions, NFC, liveness detection, document capture, and all edge cases out of the box.

\### Approach 2: Standalone API (Direct REST Calls)
Best for: Server-to-server operations, batch processing, custom verification pipelines, or when you want full control over the verification UI.
How it works: Your backend calls Didit APIs directly for individual checks (ID verification, AML screening, liveness, face matching, age estimation, phone/email verification, proof of address, etc.).
When to use: When you already have your own capture UI, when you're doing backend-only batch processing, or when you need to compose individual verification steps into a custom pipeline.
Docs: Each standalone API has its own documentation under [Standalone APIs](https://docs.didit.me/standalone-apis/id-verification.md).

\## SDK Availability — All SDKs Are Available

\### For Web Apps
1\. **JavaScript SDK** (@didit-protocol/sdk-web) — RECOMMENDED for web. Works with React, Vue, Angular, Next.js, Nuxt, Svelte, and vanilla JS. Modal and inline/embedded modes. Full TypeScript support. Install: npm install @didit-protocol/sdk-web
2\. InContext Iframe — Embed verification in your page with <iframe>. Simplest setup, no npm needed. Good for quick prototypes.
3\. Redirect — Redirect user to Didit-hosted page, they return via callback URL. Best for cross-device flows or when iframe camera access is problematic.
4\. WordPress/WooCommerce Plugin — For WordPress sites. No-code setup.
5\. Shopify Plugin — For Shopify stores. No-code setup.
6\. Salesforce — Salesforce-side integration. See /integration/web-sdks/salesforce.

\### For Mobile Apps (ALWAYS prefer native SDKs over WebView)
1\. **iOS Native SDK** — RECOMMENDED for iOS. Swift/SwiftUI/UIKit. iOS 13.0+ (NFC requires iOS 15.0+). Best UX, NFC passport/ID reading, optimized camera, 54 languages. SPM: https://github.com/didit-protocol/sdk-ios. CocoaPods: pod 'DiditSDK'
2\. **Android Native SDK** — RECOMMENDED for Android. Kotlin/Jetpack Compose. minSdk 23 (Android 6.0+); ML auto-detection on API 24+. Best UX, NFC, optimized camera, 54 languages. Maven: me.didit:didit-sdk (via https://raw.githubusercontent.com/didit-protocol/sdk-android/main/repository)
3\. **React Native SDK** — RECOMMENDED for React Native. RN 0.76+ (New Architecture), iOS 13.0+ / Android API 24+. Cross-platform TypeScript API wrapping native iOS and Android SDKs. NFC support, Expo config plugin (development build required). Install: npm install @didit-protocol/sdk-react-native
4\. **Flutter SDK** — RECOMMENDED for Flutter. Flutter 3.3+, Dart 3.11+, iOS 13.0+ / Android API 23+. Cross-platform Dart API wrapping native iOS and Android SDKs. NFC support. pub.dev: didit_sdk
5\. WebView (FALLBACK ONLY) — Only use if no native SDK is available for your platform. Loses NFC, camera optimization, and biometric integration.

\### For Backend/Server
1\. **Server SDKs** — RECOMMENDED for backend code. Official typed libraries for the Didit server APIs, with webhook signature verification built in. Python: pip install didit-sdk. Node.js/TypeScript: npm install @didit-protocol/sdk-node. Go: go get github.com/didit-protocol/sdk-go. Java/Kotlin: me.didit:didit-java. PHP: composer require didit-protocol/sdk-php guzzlehttp/guzzle. Ruby: gem install didit-sdk. .NET: dotnet add package Didit. Each reads DIDIT_API_KEY. Docs: https://docs.didit.me/integration/server-sdks/overview
2\. REST API — Server-to-server, for languages without a server SDK. Create sessions, retrieve results, manage users, call standalone APIs.
3\. Webhooks — Receive real-time verification results asynchronously.
4\. Zapier — No-code automation for verification workflows.

\## SDK Session Integration Architecture (Recommended Flow)

\### Step 1: Backend creates a session
With a server SDK: client.sessions.create(workflow_id=..., vendor_data=..., callback=...) (same method in every language, in its own case). The raw request:
POST https://verification.didit.me/v3/session/
Headers: { "x-api-key": DIDIT_API_KEY, "Content-Type": "application/json" }
Body: {
"workflow_id": DIDIT_WORKFLOW_ID,
"callback": "https://myapp.com/done",
"vendor_data": "internal-user-id"
}
Response: {
"session_id": "uuid",
"session_token": "jwt",
"verification_url": "https://verify.didit.me/...",
"status": "Not Started"
}

\### Step 2: Present verification to user (choose one)
\- Web JS SDK: DiditSdk.shared.startVerification({ url: verification_url })
\- Iframe: embed verification_url in <iframe>
\- Redirect: window.location.href = verification_url
\- iOS/Android/RN/Flutter native SDK: DiditSdk.startVerification(token: session_token)

\### Step 3: Receive results via webhook
Your backend receives POST with:
\{
"session_id": "uuid",
"status": "Approved" | "Declined" | "In Review" | "In Progress" | "Abandoned",
"vendor_data": "internal-user-id",
"decision": { ... }
}
With a server SDK, webhooks.verify(raw_body, headers, WEBHOOK_SECRET) does all of the checks below and returns a typed event. Without one, verify the webhook signature (HMAC-SHA256, lowercase hex). Pick one header:
\- X-Signature-V2 = HMAC(WEBHOOK_SECRET, canonical_json) — recommended; canonical_json is the body re-serialized with sorted keys, compact separators, and unescaped Unicode (survives middleware re-encoding).
\- X-Signature = HMAC(WEBHOOK_SECRET, raw_body) — simplest, but only if you read the exact raw bytes before any parser touches them.
Also reject if abs(now - X-Timestamp) > 300 and use a constant-time compare. Full scheme: /integration/webhooks

\### Step 4: Update your database
\- "Approved" → user.verified = true, store decision data
\- "Declined" → user.verification_status = "declined", log warnings
\- "In Review" → user.verification_status = "pending_review"
\- "Abandoned" → send reminder to user
\- "Expired" → create new session

\## Decision Data Model (from webhook or GET /v3/session/{id}/decision/)
Every per-feature result is a PLURAL ARRAY (one entry per workflow node). Never code against a singular key like `nfc` or `id_verification`.
\{
"session_id": "uuid",
"session_kind": "KYC",
"status": "Approved",
"id_verifications":    [{ "node_id": "feature_ocr", "status": "Approved", "first_name": "John", "last_name": "Doe", "document_type": "Passport" }],
"nfc_verifications":   [{ "node_id": "feature_nfc", "status": "Approved" }],
"liveness_checks":     [{ "node_id": "feature_liveness", "status": "Approved", "score": 0.99, "method": "passive" }],
"face_matches":        [{ "node_id": "feature_face_match", "status": "Approved", "score": 95 }],
"aml_screenings":      [{ "node_id": "feature_aml", "status": "Approved", "total_hits": 0, "hits": [] }],
"phone_verifications": [{ "node_id": "feature_phone", "status": "Approved", "full_number": "+14155552671", "is_disposable": false }],
"email_verifications": [{ "node_id": "feature_email", "status": "Approved", "email": "alex.sample@example.com", "is_breached": false }],
"ip_analyses":         [{ "node_id": "feature_ip",    "status": "Approved" }]
}

\## Choosing the Right Approach

\| Question | → Use SDK Sessions | → Use Standalone API |
\|----------|-------------------|---------------------|
\| User-facing verification? | ✅ Yes | For custom capture UI only |
\| Need highest completion rate? | ✅ Yes (A/B tested flows) | You manage UX yourself |
\| Need NFC passport reading? | ✅ Yes (native SDKs) | Not available |
\| Batch/backend processing? | Not ideal | ✅ Yes |
\| Custom verification pipeline? | Limited to workflows | ✅ Full flexibility |
\| Fastest integration? | ✅ Minutes with UniLink | Requires more setup |

\## Rate Limits
\- POST /v3/session/: 600 session creations per minute per application (scope: session-v2-create). Applies to every application — there is no separate free-tier limit on V3 today.
\- GET endpoints: 300 requests per minute per application (generic-get).
\- Write endpoints (POST/PATCH/DELETE): 300 per minute per application (generic-write).
\- Transaction creates and event ingestion (POST /v3/transactions/, POST /v3/events/, POST /v3/events/batch/): 600 per minute per application (ingest-write), instead of the generic write budget.
\- 429 responses include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (epoch seconds), and Retry-After. See /integration/rate-limiting.

\## Environment Variables Needed
\- DIDIT_API_KEY — from Didit Console > API & Webhooks
\- DIDIT_WEBHOOK_SECRET — from Didit Console > API & Webhooks
\- DIDIT_WORKFLOW_ID — from Didit Console > Workflows

\## AI Agent Skills (for Cursor, Claude Code, etc.)
Install pre-built skills: npx clawhub@latest install didit-sessions
GitHub: https://github.com/didit-protocol/skills

\## Docs
\- Quick Start: https://docs.didit.me/getting-started/quick-start
\- API Full Flow: https://docs.didit.me/integration/api-full-flow
\- Webhooks: https://docs.didit.me/integration/webhooks
\- Standalone APIs: https://docs.didit.me/standalone-apis/
\- API Reference: https://docs.didit.me/api-reference/overview

Based on my project, please:
1\. Recommend the best integration approach (SDK sessions vs standalone API) and the best method for my platform
2\. Create the backend endpoint to create sessions (or standalone API calls)
3\. Create the frontend component/view to present verification (if SDK approach)
4\. Create the webhook endpoint to receive results
5\. Add database schema updates to track verification status``

\</pre>



      
      

粘贴到

请根据您的平台和使用场景，选择集成 Didit 的方式。> [!NOTE]
>
> ### 推荐：通过会话集成 SDK
>
> 对于面向用户的验证（KYC 入驻、年龄验证、身份核验），我们推荐**通过托管会话集成 SDK**。验证流程经过 A/B 测试并经过优化，可实现最高的完成率、最快的速度和最佳的安全性。所有 SDK（Web、iOS、Android、React Native 和 Flutter）目前均**已可用**。
>
> 在您的后端，可使用适用于 Python、Node.js、Go、Java、PHP、Ruby 或 .NET 的[服务端 SDK](https://docs.didit.me/zh/integration/server-sdks/overview.md) 创建这些会话、读取决策结果并验证 Webhook。对于服务器到服务器的操作（批处理、自定义流水线），请通过同一套 SDK 调用**独立 API**。请参阅各个验证端点的[独立 API 文档](https://docs.didit.me/zh/standalone-apis/id-verification.md)。> [!WARNING]
>
> 如果您在自有产品中发起 Didit 会话，您仍需负责数据控制者一侧的告知与同意环节。在用户开始验证之前，请披露 Didit 为该工作流提供支持，链接您自己的隐私声明，并在需要采集证件、自拍照、活体检测数据或生物特征时收集明确同意。请参阅[安全与合规](https://docs.didit.me/zh/getting-started/security-compliance.md)、[白标](https://docs.didit.me/zh/console/white-label.md)和[创建会话](https://docs.didit.me/zh/sessions-api/create-session.md)。本 Didit Academy 课程将带您一次完成完整集成：SDK、各环境的 API 密钥、创建会话的调用，以及验证签名密钥的 Webhook 处理程序。[完整集成指南：Didit Academy](https://www.youtube.com/embed/fX03-WEu_EI?rel=0\&playsinline=1)***## Web使用 JavaScript、iframe 或重定向，将验证集成到您的 Web 应用中。> [card] [Web SDK](https://docs.didit.me/zh/integration/web-sdks/overview.md)
>
> JavaScript SDK、iframe 嵌入或重定向。支持 React、Vue、Angular 和原生 JavaScript。> [card] [JavaScript SDK](https://docs.didit.me/zh/integration/web-sdks/javascript-sdk.md)
>
> 完整的编程控制，支持事件回调和 TypeScript。> [card] [InContext 内嵌 Iframe](https://docs.didit.me/zh/integration/web-sdks/incontext-iframe.md)
>
> 将验证嵌入您的页面。借助 UniLink 无需后端。> [card] [重定向](https://docs.didit.me/zh/integration/web-sdks/web-redirect.md)
>
> 重定向至 Didit 托管的流程。支持跨设备。***## 移动端使用原生 SDK，在设备上获得最佳的相机、NFC 和活体检测体验。> [card] [原生 SDK](https://docs.didit.me/zh/integration/native-sdks/overview.md)
>
> iOS、Android、React Native、Flutter。完整支持 NFC 和生物识别。> [card] [iOS SDK](https://docs.didit.me/zh/integration/native-sdks/ios-sdk.md)
>
> 支持 SwiftUI 和 UIKit。读取 NFC 护照。现已可用。> [card] [Android SDK](https://docs.didit.me/zh/integration/native-sdks/android-sdk.md)
>
> 支持 Kotlin 和 Jetpack Compose。支持 NFC。现已可用。> [card] [React Native](https://docs.didit.me/zh/integration/native-sdks/react-native-sdk.md)
>
> 基于原生 iOS 和 Android SDK 封装的跨平台 TypeScript API。支持 NFC。现已可用。> [card] [Flutter](https://docs.didit.me/zh/integration/native-sdks/flutter-sdk.md)
>
> 基于原生 iOS 和 Android SDK 封装的跨平台 Dart API。支持 NFC。现已可用。> [card] [WebView 备用方案](https://docs.didit.me/zh/integration/web-sdks/webview-in-ios-android.md)
>
> 适用于没有原生 SDK 的平台的备用方案。如有原生 SDK，请优先使用。***## 服务端面向后端的官方库：对 Didit 服务端 API 进行类型化调用，并支持 Webhook 验证和认证令牌检查。> [card] [服务端 SDK](https://docs.didit.me/zh/integration/server-sdks/overview.md)
>
> 安装矩阵、配置、错误处理和版本管理。> [card] [Python](https://docs.didit.me/zh/integration/server-sdks/python.md)
>
> 同步和异步客户端。Python 3.10+。> [card] [Node.js](https://docs.didit.me/zh/integration/server-sdks/node.md)
>
> TypeScript 类型，支持 ESM 和 CommonJS。Node.js 18+。> [card] [Go](https://docs.didit.me/zh/integration/server-sdks/go.md)
>
> 仅使用标准库。Go 1.22+。> [card] [Java](https://docs.didit.me/zh/integration/server-sdks/java.md)
>
> 支持 Java 和 Kotlin，同步和异步调用。Java 11+。> [card] [PHP](https://docs.didit.me/zh/integration/server-sdks/php.md)
>
> 可使用任何 PSR-18 HTTP 客户端。PHP 8.1+。> [card] [Ruby](https://docs.didit.me/zh/integration/server-sdks/ruby.md)
>
> 对 Rails 友好，基于 net/http 构建。Ruby 3.1+。> [card] [.NET](https://docs.didit.me/zh/integration/server-sdks/dotnet.md)
>
> C#、异步调用、依赖注入。支持 .NET 8 和 .NET Standard 2.0。***## 集成适用于主流平台的插件和无代码工具。> [card] [Zapier](https://docs.didit.me/zh/integration/engines/zapier.md)
>
> 通过无代码触发器和操作实现自动化验证。> [card] [WordPress 与 WooCommerce](https://docs.didit.me/zh/integration/web-sdks/wordpress-woocommerce.md)
>
> 适用于 WordPress 和 WooCommerce 站点的插件。> [card] [Shopify](https://docs.didit.me/zh/integration/web-sdks/shopify.md)
>
> 在 Shopify 上验证买家，并对年龄限制商品设置门槛。> [card] [Salesforce](https://docs.didit.me/zh/integration/web-sdks/salesforce.md)
>
> 从 Salesforce 流程和记录中触发 Didit 验证。***## 快速对比| 平台 | 方式 | 状态 | NFC | 摄像头 | 适用场景 |
| - | - | - | :-: | - | - |
| Web | JavaScript SDK | ✅ 可用 | — | 浏览器 | 完全控制，适用于 React / Vue / Angular |
| Web | InContext Iframe | ✅ 可用 | — | 浏览器 | 快速嵌入，无需后端 |
| Web | 重定向 | ✅ 可用 | — | 浏览器 | 跨设备，设置简单 |
| iOS | 原生 SDK | ✅ 可用 | ✅ | 经过优化 | 最佳体验，读取 NFC 芯片 |
| Android | 原生 SDK | ✅ 可用 | ✅ | 经过优化 | 最佳体验，读取 NFC 芯片 |
| React Native | 原生 SDK | ✅ 可用 | ✅ | 经过优化 | 最佳体验，读取 NFC 芯片 |
| Flutter | 原生 SDK | ✅ 可用 | ✅ | 经过优化 | 最佳体验，读取 NFC 芯片 |
| 后端 | 服务端 SDK（Python、Node.js、Go、Java、PHP、Ruby、.NET） | ✅ 可用 | — | — | 会话、决策、独立 API、Webhook |
| 无代码 | Zapier | ✅ 可用 | — | — | 自动化工作流 |
| CMS | WordPress | ✅ 可用 | — | — | WP / WooCommerce 站点 |
| 电商 | Shopify | ✅ 可用 | — | — | Shopify 店铺 |
| CRM | Salesforce | ✅ 可用 | — | — | Salesforce 流程和记录 |## 后续步骤> [card] [API 完整流程](https://docs.didit.me/zh/integration/api-full-flow.md)
>
> 端到端会话集成：创建会话、Webhook、结果。> [card] [Webhook](https://docs.didit.me/zh/integration/webhooks.md)
>
> 实时接收验证状态更新。***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.