SDK Integration
The Secure Share SDK simplifies user verification workflows for Android, iOS, and web applications. You can include a script tag, initialise the SDK with a session ID, and manage verification processes easily. Success and error callbacks handle responses, and you can close the SDK programmatically if needed. This topic includes the following sections:
Integration
To integrate Secure Share:
-
Log in to the Merchant Dashboard and create a Secure Share template.
-
Follow the workflow below:
-
Verify user data using the Data Availability API to check user data availability using a mobile number. This step is mandatory.
-
Initiate OAuth by calling the Initiate OAuth API with the mobile number to obtain a
session_id
for opening the SDK. -
Collect user consent by opening the SDK using the
session_id
. Once the user provides consent, a callback returns anauth_code
. -
Generate an access token using the auth_code with the OAuth Access Token Generation API to get a token valid for one hour.
-
Retrieve user details using the access token with the Fetch User Details API to access user details.
-
Refer to the image below for a sample workflow:

Initializing SDKs
The SDK communicates with Cashfree and provides updates via the callbacks. Initialize the applicable SDK from the options below:
Web
To initiate the web SDK, pass the sessionId
and callback functions. Refer to the JavaScript example below:
Importing hosted JS SDK
Include the appropriate SDK version in your HTML document:
- Use the following for the production environment:
- Use the following for the sandbox environment:
Refer to the code snippet below for the HTML structure:
Android native
To set up the Android native SDK:
- Add the Maven repository to
settings.gradle.kts
: - Add SDK dependency in
build.gradle.kts
: - Click Sync Now in Android Studio to sync the project.
To initialise and use the Android native SDK:
- Create an instance of the verification service:
- Configure the callback to handle verification responses, errors, and user drop scenarios:
- Initiate the SecureShare SDK:
It consists of the following parameters:
- sessionId: Unique session identifier.
- Environment: SDK environment. Possible values are:
Environment.TEST
Environment.PROD
iOS native
To set up the iOS native SDK:
- Add the SDK to your project by updating your
Podfile
: - Run
pod install
to install the SDK.
To initialise and use the iOS native SDK:
- Create an instance of the
CFVerificationService
class: - Set up callback handlers to manage events after verification processing. Implement the
CFSecureShareResponseDelegate
protocol to handle responses and errors: - Initiate the SecureShare SDK using the following code:
It consists of the following parameters:
- sessionId: A unique identifier for the session.
- environment: Specifies the environment in which the SDK operates. Possible values are:
Environment.TEST
Environment.PROD
Callback structure
Refer to the sample response below:
Refer to the table below for the possible statuses:
Status | Description |
---|---|
SESSION_EXPIRED | The session ID is invalid. |
SESSION_ID_MISSING | No session ID is provided during initialization. |
DIV_MISSING | The <div> with ID cf-sdk is missing. |
SUCCESS | The operation is completed successfully. |
CLOSED | The SDK closes. |
Notes:
-
Ensure the
<div>
with IDcf-sdk
exists in your HTML. -
The SDK applies default styling for consistent behaviour; custom styling is not supported.
-
The iframe uses sandboxing for secure interactions.
For detailed API documentation, refer to Secure Share API Integration.
Was this page helpful?