> ## 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.

# रीडायरेक्ट द्वारा KYC: होस्टेड सत्यापन पेज

> Didit का रीडायरेक्ट-आधारित होस्टेड सत्यापन: क्रॉस-डिवाइस, कॉलबैक URL, webhook परिणाम। प्रति पूर्ण KYC जाँच $0.33 से, हर महीने $10 निःशुल्क।



रीडायरेक्ट इंटीग्रेशन प्रॉम्प्ट
        प्रॉम्प्ट को क्लिपबोर्ड पर कॉपी करें



      
      

\<pre>

\`Integrate Didit identity verification into my web app using the redirect flow.

\## How It Works
1\. Backend creates a session via POST /v3/session/ → response includes "url"
2\. Frontend redirects user to that URL: window.location.href = url
3\. User completes verification on Didit's hosted page (https://verify.didit.me/...)
4\. Didit redirects user back to your callback URL with query params:
 ?verificationSessionId=<session_id>&status=<session status, for example Approved, Declined, In Review or Expired>
5\. Your backend receives the full, signed decision via webhook (status.updated)

\## Backend: Create Session
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/verification-complete",
"callback_method": "both",      // "initiator" | "completer" | "both"
"vendor_data": "user-id-123"
}
201 response (all 10 fields, per OpenAPI):
\{
"session_id": "uuid",
"session_number": 43762,
"session_token": "3FaJ9wLqX2Mz",   // 12-char URL-safe token; valid until the session expires
"url": "https://verify.didit.me/session/3FaJ9wLqX2Mz",
"vendor_data": "user-id-123",
"metadata": null,
"status": "Not Started",
"workflow_id": "uuid",
"workflow_version": 3,
"callback": "https://myapp.com/verification-complete"
}
The field is named "url" — redirect the user there. Never build the URL from session_token
by hand (with "language" set, the URL gains a language segment: /es/session/...).

\## Frontend: Redirect User
window.location.href = session.url; // value of "url" from the API response

\## Callback Page: Handle Return
const params = new URLSearchParams(window.location.search);
const sessionId = params.get('verificationSessionId');
const status    = params.get('status'); // the session status, e.g. "Approved", "Declined", "In Review" or "Expired"
// IMPORTANT: Treat these query params as untrusted UI hints.
// Always confirm the final result on your backend via webhook OR by calling
// GET /v3/session/{session_id}/decision/

\## Callback Methods
\- "initiator": redirect only the device that started the flow
\- "completer": redirect the device that finished verification (e.g. mobile after QR hand-off)
\- "both": redirect whichever device is active (recommended for reliability)

\## Webhook: Receive Full Results
POST to your webhook URL with full decision data.
Verify HMAC-SHA256 signature with X-Signature-V2 header — see /integration/webhooks.

\## Rate Limits
600 session-create requests per minute per API key (falls back to bearer token, then client IP), plus a shared 300 write-requests/minute budget across all endpoints. HTTP 429 with Retry-After when exceeded.

\## Environment Variables
\- DIDIT_API_KEY — backend only (Didit Console > API & Webhooks)
\- DIDIT_WEBHOOK_SECRET — backend only (per-destination, Didit Console > API & Webhooks)
\- DIDIT_WORKFLOW_ID — backend only (Didit Console > Workflows)

\## Docs
\- Redirect flow: https://docs.didit.me/integration/web-sdks/web-redirect
\- Create Session: https://docs.didit.me/sessions-api/create-session
\- Retrieve Decision: https://docs.didit.me/sessions-api/retrieve-session
\- Webhooks: https://docs.didit.me/integration/webhooks`

\</pre>



      
      

यहाँ पेस्ट करें

रीडायरेक्ट विधि उपयोगकर्ताओं को सत्यापन के लिए Didit-होस्टेड पेज पर भेजती है और फिर कॉलबैक URL के ज़रिए उन्हें आपके ऐप पर वापस लाती है।| सुविधा | विवरण |
| - | - |
| सेटअप समय | 5 मिनट |
| बैकएंड आवश्यक | ✅ हाँ (सत्र बनाने के लिए) |
| आपके डोमेन पर रहता है | ❌ नहीं (verify.didit.me या आपके व्हाइट लेबल कस्टम डोमेन पर रीडायरेक्ट होता है) |
| क्रॉस-डिवाइस समर्थन | ✅ हाँ |
| ब्राउज़र संगतता | ✅ सभी ब्राउज़र |***## रीडायरेक्ट कब उपयोग करें- **क्रॉस-डिवाइस सत्यापन**: डेस्कटॉप पर शुरू करें, मोबाइल पर पूरा करें
- **अधिकतम संगतता**: पुराने ब्राउज़रों सहित सभी ब्राउज़रों में काम करता है
- **सरल इंटीग्रेशन**: iframe कॉन्फ़िगरेशन की ज़रूरत नहीं है
- **कैमरा समस्याएँ**: जब iframe में कैमरा एक्सेस समस्याग्रस्त हो***## इम्प्लीमेंटेशन### चरण 1: सत्र बनाएँ (बैकएंड)सत्र-निर्माण रिस्पॉन्स में **`url`** नाम का फ़ील्ड होता है। उस मान को ब्राउज़र को पास करें।```javascript theme={null}
// Node.js / Express
app.post('/api/create-verification', async (req, res) => {
  const { userId } = req.body;

  const response = await fetch('https://verification.didit.me/v3/session/', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.DIDIT_API_KEY,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      workflow_id: process.env.DIDIT_WORKFLOW_ID,
      vendor_data: userId,
      callback: 'https://yourapp.com/verification-complete',
      callback_method: 'both', // most reliable across desktop ↔ mobile handoffs
    }),
  });

  if (!response.ok) {
    return res.status(response.status).send(await response.text());
  }

  const session = await response.json();
  // 201 per OpenAPI: { session_id, session_number, session_token, url, vendor_data,
  //                    metadata, status, workflow_id, workflow_version, callback }
  res.json({ sessionId: session.session_id, verificationUrl: session.url });
});
```### चरण 2: उपयोगकर्ता को रीडायरेक्ट करें (फ़्रंटएंड)**HTML:**```html theme={null}
<button onclick="startVerification()">Verify Identity</button>

<script>
  async function startVerification() {
    const response = await fetch('/api/create-verification', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ userId: 'user-123' })
    });
    
    const { verificationUrl } = await response.json();
    window.location.href = verificationUrl;
  }
</script>
```**React:**```tsx theme={null}
function VerifyButton() {
  const [loading, setLoading] = useState(false);

  const startVerification = async () => {
    setLoading(true);
    
    const response = await fetch('/api/create-verification', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ userId: 'user-123' })
    });
    
    const { verificationUrl } = await response.json();
    window.location.assign(verificationUrl);
  };

  return (
    <button onClick={startVerification} disabled={loading}>
      {loading ? 'Loading...' : 'Verify Identity'}
    </button>
  );
}
```**Vue:**```vue theme={null}
<template>
  <button @click="startVerification" :disabled="loading">
    {{ loading ? 'Loading...' : 'Verify Identity' }}
  </button>
</template>

<script setup>
import { ref } from 'vue';

const loading = ref(false);

async function startVerification() {
  loading.value = true;
  
  const response = await fetch('/api/create-verification', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ userId: 'user-123' })
  });
  
  const { verificationUrl } = await response.json();
  window.location.href = verificationUrl;
}
</script>
```***## कॉलबैक को संभालनाजब सत्यापन पूरा हो जाता है, तो Didit क्वेरी पैरामीटर के साथ आपके कॉलबैक URL पर रीडायरेक्ट करता है:```
https://yourapp.com/verification-complete?verificationSessionId=abc123&status=Approved
```| पैरामीटर | विवरण |
| - | - |
| `verificationSessionId` | अद्वितीय सत्र पहचानकर्ता |
| `status` | सत्र की वर्तमान स्थिति, उदाहरण के लिए `Approved`, `Declined`, `In Review` या `Expired`। देखें [सत्यापन स्थितियाँ](https://docs.didit.me/hi/integration/verification-statuses.md) |### Next.js उदाहरण```tsx theme={null}
// pages/verification-complete.tsx
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';

export default function VerificationComplete() {
  const router = useRouter();
  const { verificationSessionId, status } = router.query;
  const [message, setMessage] = useState('Processing...');

  useEffect(() => {
    if (!router.isReady) return;

    async function handleResult() {
      // Optionally verify the result with your backend
      await fetch('/api/verify-session', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ 
          sessionId: verificationSessionId, 
          status 
        })
      });

      // Redirect based on status
      switch (status) {
        case 'Approved':
          setMessage('Verification successful! Redirecting...');
          setTimeout(() => router.push('/dashboard'), 2000);
          break;
        case 'Declined':
          setMessage('Verification was not successful.');
          setTimeout(() => router.push('/verification-failed'), 2000);
          break;
        case 'In Review':
          setMessage('Your verification is under review.');
          setTimeout(() => router.push('/verification-pending'), 2000);
          break;
        default:
          setMessage('Unknown status. Please contact support.');
      }
    }

    handleResult();
  }, [router.isReady, verificationSessionId, status]);

  return (
    <div className="flex flex-col items-center justify-center min-h-screen">
      <div className="animate-spin w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full mb-4" />
      <p className="text-lg">{message}</p>
    </div>
  );
}
```### Express.js उदाहरण```javascript theme={null}
// routes/verification.js
app.get('/verification-complete', async (req, res) => {
  const { verificationSessionId, status } = req.query;
  
  // Optionally verify with Didit API
  // const session = await diditApi.getSession(verificationSessionId);
  
  // Update your database
  await db.users.update({
    where: { verificationSessionId },
    data: { verificationStatus: status }
  });
  
  // Redirect based on status
  switch (status) {
    case 'Approved':
      res.redirect('/dashboard?verified=true');
      break;
    case 'Declined':
      res.redirect('/verification-failed');
      break;
    case 'In Review':
      res.redirect('/verification-pending');
      break;
    default:
      res.redirect('/error');
  }
});
```### Vue Router उदाहरण```typescript theme={null}
// router/index.ts
{
  path: '/verification-complete',
  component: () => import('@/views/VerificationComplete.vue'),
  beforeEnter: async (to, from, next) => {
    const { verificationSessionId, status } = to.query;
    
    // Store result and redirect
    await store.dispatch('verification/handleResult', { 
      sessionId: verificationSessionId, 
      status 
    });
    
    if (status === 'Approved') {
      next('/dashboard');
    } else if (status === 'Declined') {
      next('/verification-failed');
    } else {
      next('/verification-pending');
    }
  }
}
```***## नए टैब में खोलनायदि आप उपयोगकर्ता के सत्यापन के दौरान अपना ऐप खुला रखना चाहते हैं:```javascript theme={null}
// Open in new tab
window.open(verificationUrl, '_blank');

// Poll for completion or use webhooks
```> [!TIP]
>
> नए टैब का उपयोग करते समय, सत्यापन पूरा होने की जानकारी पाने के लिए इसे [webhook](https://docs.didit.me/hi/integration/webhooks.md) के साथ जोड़ें।***## सुरक्षा सर्वोत्तम प्रथाएँ### कॉलबैक की सर्वर-साइड पुष्टि करें`verificationSessionId` और `status` क्वेरी पैरामीटर को अविश्वसनीय UI संकेत मानें। अंतिम निर्णय की पुष्टि हमेशा अपने बैकएंड पर करें, या तो [webhook](https://docs.didit.me/hi/integration/webhooks.md) को संभालकर (अनुशंसित) या API के ज़रिए निर्णय दोबारा प्राप्त करके:```javascript theme={null}
// Backend: re-fetch the canonical decision before granting access
app.get('/verification-complete', async (req, res) => {
  const { verificationSessionId } = req.query;

  const response = await fetch(
    `https://verification.didit.me/v3/session/${verificationSessionId}/decision/`,
    {
      headers: { 'x-api-key': process.env.DIDIT_API_KEY },
    }
  );

  if (!response.ok) {
    return res.status(response.status).send(await response.text());
  }

  const decision = await response.json();

  // decision.status uses the canonical enum:
  // Not Started | In Progress | Awaiting User | In Review | Approved |
  // Declined   | Resubmitted | Expired | Kyc Expired | Abandoned
  if (decision.status === 'Approved') {
    // Grant access. Per-feature reports are plural arrays:
    //   decision.id_verifications[], decision.face_matches[], decision.aml_screenings[], ...
  }

  res.redirect('/dashboard');
});
```### Webhooks का उपयोग करेंसबसे विश्वसनीय इंटीग्रेशन के लिए, [webhook](https://docs.didit.me/hi/integration/webhooks.md) का उपयोग करें ताकि उपयोगकर्ता के ब्राउज़र के व्यवहार की परवाह किए बिना सत्यापन परिणाम सीधे आपके बैकएंड पर पहुँचें।***## क्रॉस-डिवाइस फ़्लोरीडायरेक्ट विधि स्वाभाविक रूप से क्रॉस-डिवाइस सत्यापन का समर्थन करती है:1) उपयोगकर्ता डेस्कटॉप पर "Verify" पर क्लिक करता है
2) उपयोगकर्ता सत्यापन पेज पर रीडायरेक्ट होता है
3) ज़रूरत हो तो उपयोगकर्ता मोबाइल पर जारी रखने के लिए QR कोड स्कैन कर सकता है
4) पूरा होने के बाद उपयोगकर्ता आपके कॉलबैक URL पर रीडायरेक्ट होता है। कौन-सा डिवाइस रीडायरेक्ट होगा, यह `callback_method` (`initiator`, `completer`, या `both`) से नियंत्रित होता है***## समस्या निवारण### कॉलबैक प्राप्त नहीं हुआ1) जाँचें कि सत्र बनाते समय कॉलबैक URL सही तरीके से सेट किया गया था
2) सुनिश्चित करें कि आपका कॉलबैक URL इंटरनेट से एक्सेस किया जा सकता है
3) जाँचें कि URL में टाइपो या एन्कोडिंग की समस्या नहीं है### स्थिति हमेशा "Declined" दिखती है1) Didit Console में अपनी वर्कफ़्लो सेटिंग्स जाँचें
2) जाँचें कि आप जो टेस्ट दस्तावेज़ उपयोग कर रहे हैं वे मान्य हैं
3) विशिष्ट अस्वीकृति कारणों के लिए API के ज़रिए सत्र का विवरण देखें### रीडायरेक्ट लूप1) सुनिश्चित करें कि आपका कॉलबैक हैंडलर सत्यापन पर वापस रीडायरेक्ट नहीं करता
2) अपने कॉलबैक पेज पर कैशिंग की समस्याएँ जाँचें
3) ब्राउज़र कैश साफ़ करें और दोबारा प्रयास करें***## उदाहरण रिपॉज़िटरी> [card] [GitHub रिपॉज़िटरी](https://github.com/didit-protocol/didit-full-demo)
>
> GitHub पर सोर्स कोड और उदाहरण देखें


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