Key building blocks and how they fit together
Lark provides modular infrastructure for Loan Against Securities (LAS) with:
Consolidated Account Statement retrieval
Header | Description |
---|---|
Authorization | Bearer token for API access |
X-API-Key | Your unique API key |
/mfcentral/cas/summary
or /mfcentral/cas/detail
/mfcentral/validate-otp
/mfcentral/cas/document
/mfcentral/cas/summary
/mfcentral/cas/detail
/mfcentral/validate-otp
/mfcentral/cas/document
{
"status": "success",
"message": "CAS request initiated successfully",
"data": {
"session_id": "ses_abc123def456",
"otp_sent": true,
"otp_delivery": {"mobile": "9876543210", "email": "inv***@example.com"},
"expires_at": "2025-08-27T15:05:00Z"
}
}
INVALID_PAN
• PAN format incorrectMISSING_MOBILE
• Mobile is requiredINVALID_OTP
• OTP incorrectOTP_EXPIRED
• OTP expiredSESSION_NOT_FOUND
• Invalid/expired sessionACCESS_TOKEN_EXPIRED
• Download token expiredSandbox: https://api-sandbox.example.com
curl -X POST https://api-sandbox.example.com/mfcentral/cas/summary -H "Content-Type: application/json" -H "Authorization: Bearer your_test_token" -H "X-API-Key: your_test_api_key" -d '{
"pan": "AAAAA0000A",
"mobile": "9876543210",
"email": "test@example.com"
}'
Capital Gains Statement for tax reporting
Header | Description |
---|---|
Authorization | Bearer token for API access |
X-API-Key | Your unique API key |
/mfcentral/cas/detail
/mfcentral/validate-otp
/mfcentral/cas/document
/mfcentral/cas/detail
/mfcentral/validate-otp
/mfcentral/cas/document
{
"status": "success",
"message": "CGS request initiated successfully",
"data": {
"session_id": "ses_cgs789xyz456",
"otp_sent": true,
"otp_delivery": {"email": "inv***@example.com"},
"calculation_period": {"to_date": "2025-03-31"},
"expires_at": "2025-08-27T15:05:00Z"
}
}
INVALID_DATE_RANGE
• From date must be before to dateNO_TRANSACTIONS_FOUND
• No taxable transactions in rangeINVALID_OTP
/ OTP_EXPIRED
SESSION_NOT_FOUND
ACCESS_TOKEN_EXPIRED
Sandbox: https://api-sandbox.example.com
curl -X POST https://api-sandbox.example.com/mfcentral/cas/detail -H "Content-Type: application/json" -H "Authorization: Bearer your_test_token" -H "X-API-Key: your_test_api_key" -d '{
"pan": "AAAAA0000A",
"mobile": "9876543210",
"email": "test@example.com",
"from_date": "2024-04-01",
"to_date": "2025-03-31"
}'
LARK SDK Developer Integration Guide v1.0.12
The LARK NPM Package provides a seamless way to integrate loan eligibility checking into your React/Vue.js/Next.js applications. It offers a complete loan origination flow with mutual fund portfolio backing.
Get up and running in minutes with our simple SDK
Built with security best practices and encryption
Responsive design that works on all devices
Theme and customize to match your brand
1. Install the package
npm install lark-sdk-multi
2. Import and initialize
import LoanEligibilitySDK from 'lark-sdk-multi';
const sdk = new LoanEligibilitySDK({
apiKey: 'your-api-key',
apiSecret: 'your-api-secret',
phoneNumber: '+919876543210'
});
Install the LARK SDK in your React project
npm install lark-sdk-multi
yarn add lark-sdk-multi
For local development, you can install the SDK as a file dependency:
"lark-sdk-multi": "file:../path/to/sdk"
LARK SDK is available for multiple platforms to fit your development needs
Full-featured React SDK with TypeScript support, state management, and comprehensive hooks.
npm install lark-sdk-multi
# or with yarn
yarn add lark-sdk-multi
Cross-platform Flutter SDK for mobile applications.
import LoanEligibilitySDK from 'lark-sdk-multi';
const sdk = new LoanEligibilitySDK({
apiKey: 'your-api-key',
apiSecret: 'your-api-secret',
phoneNumber: '+919876543210'
});
await sdk.initialize({
partnerId: 'your-partner-id'
});
sdk.openEligibilityCheck('inline');
Configure your environment and SDK credentials
VITE_SDK_KEY=your_sdk_key_here
VITE_SDK_SECRET=your_sdk_secret_here
VITE_PARTNER_ID=your_partner_id_here
VITE_API_URL=https://api.larkfinserv.in
interface PartnerConfig {
apiKey: string;
apiSecret: string;
partnerId?: string;
phoneNumber?: string;
environment?: 'sandbox' | 'production';
theme?: ThemeConfig;
}
Complete integration example with React hooks and state management
import React, { useState, useEffect } from 'react';
import LoanEligibilitySDK from 'lark-sdk-multi';
import type { SDKEvent } from 'lark-sdk-multi/src/types';
function App() {
const [sdk, setSdk] = useState<LoanEligibilitySDK | null>(null);
const [status, setStatus] = useState<'idle' | 'loading' | 'success' | 'error'>('idle');
const [phoneNumber, setPhoneNumber] = useState('');
useEffect(() => {
if (phoneNumber.length !== 10) return;
const sdkInstance = new LoanEligibilitySDK({
apiKey: process.env.REACT_APP_SDK_KEY!,
apiSecret: process.env.REACT_APP_SDK_SECRET!,
phoneNumber: `+91${phoneNumber}`,
});
// Event handlers
sdkInstance.on('INITIATED', () => setStatus('loading'));
sdkInstance.on('READY', () => setStatus('success'));
sdkInstance.on('ELIGIBILITY_RESULT', (event: SDKEvent) => {
console.log('Result:', event.data);
});
sdkInstance.on('ERROR', (event: SDKEvent) => {
console.error('Error:', event.data);
setStatus('error');
});
setSdk(sdkInstance);
}, [phoneNumber]);
const handleStartCheck = async () => {
if (!sdk) return;
try {
await sdk.initialize({
partnerId: process.env.REACT_APP_PARTNER_ID!,
apiKey: process.env.REACT_APP_SDK_KEY!,
apiSecret: process.env.REACT_APP_SDK_SECRET!,
});
sdk.openEligibilityCheck('inline');
} catch (error) {
console.error('Failed to start check:', error);
setStatus('error');
}
};
return (
<div>
<input
type="tel"
value={phoneNumber}
onChange={(e) => setPhoneNumber(e.target.value.replace(/\D/g, ''))}
placeholder="Enter 10-digit mobile number"
maxLength={10}
/>
<button
onClick={handleStartCheck}
disabled={phoneNumber.length !== 10 || status === 'loading'}
>
{status === 'loading' ? 'Loading...' : 'Start Eligibility Check'}
</button>
<div id="loan-eligibility-sdk"></div>
</div>
);
}
Complete API documentation for the LARK SDK
new LoanEligibilitySDK(config: PartnerConfig)
Creates a new SDK instance with the provided configuration
initialize(config: PartnerConfig): Promise<void>
Initializes the SDK with partner configuration and retrieves session data from the server.
openEligibilityCheck(mode: 'inline' | 'popup'): void
Opens the eligibility check form in either inline modal or popup window mode.
closeFrame(): void
Closes the SDK frame and cleans up all resources and event listeners.
on(event: string, handler: Function): void
Registers an event handler for SDK events like READY, ELIGIBILITY_RESULT, etc.
INITIATED
- Fired when the SDK frame is opened and initialization beginsREADY
- Fired when the SDK is fully loaded and ready for user interactionELIGIBILITY_RESULT
- Fired when eligibility check is completed successfully with resultsERROR
- Fired when an error occurs during the eligibility check processCLOSE_FRAME
- Fired when the SDK frame is closed by user action or systemReal-world examples and practical use cases
const sdk = new LoanEligibilitySDK({
apiKey: 'your-api-key',
apiSecret: 'your-api-secret',
phoneNumber: '+919876543210',
theme: {
primaryColor: '#007bff',
secondaryColor: '#6c757d',
fontFamily: 'Inter, sans-serif',
borderRadius: '8px'
}
});
// Detect mobile and adjust SDK behavior
const isMobile = window.innerWidth < 768;
// Use popup for mobile, inline for desktop
sdk.openEligibilityCheck(isMobile ? 'popup' : 'inline');
// Listen for orientation changes
window.addEventListener('orientationchange', () => {
const isNowMobile = window.innerWidth < 768;
if (isNowMobile !== isMobile) {
sdk.closeFrame();
sdk.openEligibilityCheck(isNowMobile ? 'popup' : 'inline');
}
});
sdk.on('ERROR', (event) => {
const error = event.data.error;
switch (error.code) {
case 'NETWORK_ERROR':
showErrorMessage('Network connection issue.');
break;
case 'VALIDATION_ERROR':
showErrorMessage(`Validation failed: ${error.message}`);
break;
case 'AUTH_ERROR':
showErrorMessage('Authentication failed.');
break;
default:
showErrorMessage('An unexpected error occurred.');
}
});
Common issues and solutions
Problem: The SDK frame appears blank or doesn't load.
Solution:
Problem: Getting 401 or 403 errors during initialization.
Solution:
Problem: SDK doesn't display properly on mobile devices.
Solution:
Embed eligibility and journeys in your app
Add dependency in pubspec.yaml:
dependencies:
larkfinserv_flutter_sdk: ^0.0.3
Install and import:
flutter pub get
import 'package:larkfinserv_flutter_sdk/larkfinserv_flutter_sdk.dart';
final sdk = LarkFinServSDK();
await sdk.initialize(PartnerConfig(
apiKey: 'your_api_key',
apiSecret: 'your_api_secret',
environment: 'sandbox',
));
await sdk.openEligibilityCheck(SDKMode.popup);
initialize(PartnerConfig)
→ Future<void>
openEligibilityCheck(SDKMode)
→ Future<void>
createWebViewController()
→ WebViewController
events
→ Stream<SDKEvent>
dispose()
Use PartnerConfig (portal theme takes precedence):
PartnerConfig(
apiKey: 'sandbox_api_key',
apiSecret: 'sandbox_api_secret',
environment: 'sandbox',
theme: ThemeConfig(
primaryColor: '#2196F3',
secondaryColor: '#FF9800',
name: 'MyFinance App',
),
)
Inline widget with event handling:
sdk.events.listen((event) {
switch (event.type) {
case SDKEventType.eligibilityResult:
// handle result
break;
case SDKEventType.error:
// handle error
break;
default:
break;
}
});
ready
• SDK readyinitiated
• Flow startedeligibilityResult
• Result availableerror
• Error occurredclose
• UI closedcloseFrame
• WebView closedINVALID_CONFIG
• Check keys/secretsINITIALIZATION_FAILED
• Verify network/credentialsSDK_NOT_INITIALIZED
• Call initialize()URL_LAUNCH_FAILED
, WEBVIEW_ERROR
iOS: add ATS and LSApplicationQueriesSchemes. Android: INTERNET and ACCESS_NETWORK_STATE; queries for http/https. Web: ensure CSP allows inline.
Comprehensive user and portfolio data access
The Data API provides comprehensive access to user information, portfolio data, and loan management capabilities. It's designed to support the complete loan lifecycle from eligibility checking to disbursement and repayment.
Complete user profiles, KYC status, and verification details
Real-time mutual fund holdings and valuations
Loan applications, offers, and management
https://sdk-backend.larkfinserv.com
application/json
Header | Description |
---|---|
Authorization | Bearer token for authentication |
X-SDK-Key | Your SDK API key |
X-SDK-Secret | Your SDK API secret |
accept | Content type acceptance |
origin | Request origin |
referer | Request referer |
/users
/loan-sdk/init
/loan-sdk/verify-phone
/loan-sdk/verify-otp
/loan-sdk/verify-pan
/loan-sdk/fetch-portfolio
/loan-sdk/get-offers
/loan-sdk/verify-portfolio-otp
/loan-sdk/submit-application
/loan-sdk/status/{applicationId}
/loan-management/loan-summary
/loan-management/create-disbursement
/loan-management/create-repayment-order
{
"id": "74c3355b-87d3-4aae-9f9a-cb479aceb287",
"first_name": "AWNISH",
"last_name": "DUBEY",
"phone_no": "+919958989595",
"email": "919958989595@placeholder.com",
"roles": ["customer"],
"status": "active",
"dob": "2002-02-02",
"partner_id": "2a3b5cde-2506-4cc3-af65-ae033a7beff1",
"device_info": {
"partnerId": "2a3b5cde-2506-4cc3-af65-ae033a7beff1",
"phone_otp": null,
"timestamp": "2025-08-14T13:20:36.990Z",
"createdVia": "SDK_INIT",
"is_phone_verified": "true",
"phone_otp_expires_at": null
},
"pan": "GQNPD9571A",
"reported_issues": [],
"created_at": "2025-08-14T13:20:37.068Z",
"updated_at": "2025-08-14T13:20:46.074Z",
"partner": {
"id": "2a3b5cde-2506-4cc3-af65-ae033a7beff1",
"company_name": "",
"status": "active",
"partner_type": "other"
},
"portfolio": {
"userId": "74c3355b-87d3-4aae-9f9a-cb479aceb287",
"pan": "GQNPD9571A",
"reportedIssues": [],
"portfolio": null,
"hasPortfolio": false
}
}
Field | Type | Description |
---|---|---|
id | string | Unique identifier of the user |
first_name | string | User's first name |
last_name | User's last name | |
phone_no | Registered phone number | |
email | User's email address | |
roles | Roles assigned to the user (e.g., customer) | |
status | Account status (active/inactive) | |
dob | Date of birth of the user | |
partner_id | Associated partner's unique identifier | |
device_info | Metadata related to user's device and SDK init info | |
pan | Permanent Account Number of the user | |
reported_issues | List of issues reported by the user | |
created_at | Timestamp when user was created | |
updated_at | Timestamp when user was last updated | |
partner | Partner details associated with the user | |
portfolio | Portfolio details of the user |
SDK-specific endpoints and integration flow
Typical flow:
/loan-sdk/init
/loan-sdk/init
/loan-sdk/verify-phone
/loan-sdk/verify-otp
/loan-sdk/verify-pan
/loan-sdk/fetch-portfolio
/loan-sdk/verify-portfolio-otp
/loan-sdk/get-offers
/loan-sdk/submit-application
/loan-sdk/status/{applicationId}
/loan-origination/init-kyc-bfl
/loan-origination/init-vkyc-bfl
/loan-origination/bfl-loan-creation
/loan-origination/kyc-status
/loan-origination/opportunity-status
/loan-origination/trigger-otp-pledge
/loan-origination/verify-otp-pledge/{utilityReferenceId}
/loan-origination/submit-opportunity
/loan-management/loan-summary
/loan-management/loan-details
/loan-management/create-disbursement
/loan-management/create-repayment-order
/loan-management/soa-report
/loan-management/holding-statement
/loan-management/foreclosure/details
/loan-management/foreclosure/initiate
/loan-management/shortfall/details
SLA, contacts, and next steps