react-native-kyc-sdk-webninjaz
v1.0.0
Published
A React Native SDK for KYC (Know Your Customer) verification
Maintainers
Readme
React Native KYC SDK
A React Native SDK for KYC (Know Your Customer) verification that provides a simple way to integrate KYC functionality into your React Native applications.
Features
- Camera and storage permissions handling
- Document verification
- API integration for KYC verification
- Cross-platform support (iOS and Android)
- Easy to integrate and use
- Authentication support
Installation
npm install react-native-kyc-sdk
# or
yarn add react-native-kyc-sdkiOS Setup
Add the following to your ios/Podfile:
pod 'react-native-permissions', :path => '../node_modules/react-native-permissions'Then run:
cd ios && pod installAndroid Setup
Add the following permissions to your android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />Usage
import ReactNativeKycSdk from 'react-native-kyc-sdk';
// Initialize the SDK
const kycSdk = new ReactNativeKycSdk({
baseUrl: 'https://kyc.webninjaz.com/api/v1' // optional, defaults to this URL
});
// Login to the service
const login = async () => {
try {
const response = await kycSdk.login(
'[email protected]',
'Mahesh@321'
);
console.log('Login successful:', response);
} catch (error) {
console.error('Login failed:', error);
}
};
// Start KYC verification
const startVerification = async () => {
try {
// Initialize SDK
await kycSdk.initialize();
// Start verification process
const result = await kycSdk.startKycVerification({
userId: 'user123',
documentType: 'passport',
// Add other required user data
});
console.log('Verification started:', result);
} catch (error) {
console.error('Verification failed:', error);
}
};
// Check verification status
const checkStatus = async (verificationId) => {
try {
const status = await kycSdk.getVerificationStatus(verificationId);
console.log('Verification status:', status);
} catch (error) {
console.error('Failed to get status:', error);
}
};API Reference
login(userEmail, userPassword)
Authenticates the user with the KYC service.
Parameters:
userEmail(String): User's email addressuserPassword(String): User's password
Returns:
- Promise that resolves with the login response containing the authentication token
initialize()
Initializes the SDK and requests necessary permissions.
startKycVerification(userData)
Starts the KYC verification process.
Parameters:
userData(Object): User information and document details
getVerificationStatus(verificationId)
Checks the status of a verification process.
Parameters:
verificationId(String): The ID of the verification process
Error Handling
The SDK throws errors in the following cases:
- Authentication failed
- Permission denied
- Network errors
- Invalid user data
- Server errors
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
