🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@cashfreepayments/digilocker-js-sdk

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cashfreepayments/digilocker-js-sdk

![License](https://img.shields.io/badge/license-MIT-blue) ![Release](https://img.shields.io/badge/release-v1.0.3-blue) ![Build](https://img.shields.io/badge/build-stable-brightgreen)

latest
npmnpm
Version
1.0.9
Version published
Maintainers
3
Created
Source

Cashfree DigiLocker JS SDK

License Release Build

The DigiLocker JS SDK provides a seamless integration for DigiLocker services in web applications. This SDK enables secure document verification and retrieval through the DigiLocker platform, allowing businesses to implement KYC workflows efficiently.

Features

  • Simple Integration: Easy-to-use API for DigiLocker integration
  • Multiple Environment Support: Works in browsers, webviews, and iframe contexts
  • React Compatible: Built-in React component for quick implementation
  • Customizable UI: Use default buttons or custom UI elements

Installation

npm install @cashfreepayments/digilocker-js-sdk

Usage

React Implementation

import { Digilocker } from '@cashfreepayments/digilocker-js-sdk';

function MyComponent() {
  const handleComplete = (data) => {
    console.log('Verification completed:', data);
    // Handle verification result
  };

  return (
    <Digilocker
      documents={['AADHAAR', 'PAN', 'DRIVING_LICENSE']}
      onComplete={handleComplete}
      buttonText="Start DigiLocker KYC"
      config={{
        baseURL: 'https://your-api-endpoint.com',
        headers: {
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
        }
      }}
    />
  );
}

Custom Trigger Element

import { Digilocker } from '@cashfreepayments/digilocker-js-sdk';

function MyComponent() {
  return (
    <Digilocker
      documents={['AADHAAR', 'PAN']}
      onComplete={handleComplete}
      config={{
        baseURL: 'https://your-api-endpoint.com',
        headers: { /* your headers */ }
      }}
      trigger={<button className="my-custom-button">Verify with DigiLocker</button>}
    />
  );
}

API Reference

Digilocker Component

PropTypeRequiredDefaultDescription
documentsstring[]No['AADHAAR', 'PAN', 'DRIVING_LICENSE']List of documents to request from DigiLocker
onComplete(data: any) => voidYes-Callback function called when verification is complete
buttonTextstringNo'Start DigiLocker KYC'Text to display on the default button
config{ baseURL: string; headers: Record<string, string> }Yes-Configuration for API endpoints and headers
triggerReact.ReactElementNo-Custom element to trigger DigiLocker flow

Configuration Object

{
  baseURL: string;       // Your API base URL
  headers: {             // Headers to include in API requests
    Authorization: string;
    [key: string]: string;
  }
}

Response Object

The onComplete callback receives a response object with the following structure:

{
  status: string;        // Status of verification (e.g., 'AUTHENTICATED')
  verification_id: string; // Unique identifier for this verification
  document_consent: Array<{
    document_type: string; // Type of document verified
    document_id: string;  // Document identifier
    // Additional document details
  }>;
  // Additional verification details
}

Browser Compatibility

The SDK supports all modern browsers:

  • Chrome (latest 2 versions)
  • Firefox (latest 2 versions)
  • Safari (latest 2 versions)
  • Edge (latest 2 versions)

License

This project is licensed under the MIT License.

FAQs

Package last updated on 08 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts