react-native-finosuvidha-account
v1.0.6
Published
This is a React Native module that provides a seamless integration of the Fino Suvidha Account Opening SDK into your React Native Android applications.
Readme
react-native-finosuvidha-account
This is a React Native module that provides a seamless integration of the Fino Suvidha Account Opening SDK into your React Native Android applications.
Installation
Step 1
npm install react-native-finosuvidha-accountStep 2
1. Add .aar dependency
Download the required .aar from the Suvidha Account Opening Mobile SDKs Drive and place it in your app module:
android/app/libs/dmt_casa_live-release.aar
⚠️ Make sure the filename matches exactly, including extension and case.
2. Configure Gradle to include local .aar files
Open your app module's android/app/build.gradle and ensure there is a repositories block.
- If it exists, add the
flatDirline inside it:
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs' // <- This tells Gradle to look in android/app/libs for .aar files
}
}- If the
repositoriesblock does not exist, add the whole block above.
Step 3
Update AndroidManifest.xml
In your AndroidManifest.xml (usually at android/app/src/main/AndroidManifest.xml):
1️⃣ Add the tools namespace inside the root <manifest> tag:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">2️⃣ Add the tools:replace attribute inside the <application> tag:
<application
...
tools:replace="android:allowBackup,android:theme">
...
</application>💡Note:
xmlns:toolsmust be declared inside the root<manifest>tag.tools:replaceis used to overrideandroid:allowBackupandandroid:themevalues defined by libraries, preventing manifest merge conflicts.
Step 4
Create file_paths.xml
Create a new file named file_paths.xml at the following location: android/app/src/main/res/xml/file_paths.xml. If the xml folder doesn’t exist, create it manually.
Add the following content:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Allow sharing of files from internal storage -->
<files-path name="internal_files" path="." />
<!-- Allow sharing of files from external app-specific storage -->
<external-files-path name="external_files" path="." />
<!-- Allow sharing specifically from Pictures directory -->
<external-files-path name="pictures" path="Pictures/" />
</paths>
💡 Note: This file defines which directories your app can share files from through the FileProvider.
Step 5
Add the FileProvider Entry
Now, add the following <provider> block inside the <application> tag of your AndroidManifest.xml:
<application
...
tools:replace="android:allowBackup,android:theme">
...
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
💡 Note:
${applicationId}will automatically resolve to your app’s package name (e.g.,com.example.myapp), so you don’t need to replace it manually.- The
<meta-data>tag links yourFileProviderto thefile_paths.xmlfile, defining which files your app can share securely.
Troubleshooting
- Manifest merge conflict on
android:allowBackuporandroid:theme: Ensure you addedtools:replace="android:allowBackup android:theme"inside the<application>tag andxmlns:tools="http://schemas.android.com tools"in the<manifest>tag. - FileProvider authority conflicts:
Make sure${applicationId}.fileprovidermatches your app’s package name and that no other provider in your project uses the same authority.
Usage
Before calling startAccount(), you need to obtain the encToken.
- You can get the
encTokenfrom the Paysprint Query Remitter API. Refer to the Paysprint Query Remitter
Documentation. - The API response contains a parameter called
sdk_token. Thissdk_tokenis the encrypted data (encToken) that you should
pass to thestartAccount()function.
import { startAccount } from 'react-native-finosuvidha-account';
// Get encToken from Paysprint Query Remitter API
const encToken = response.data.sdk_token; // Example
// Call startAccount with encToken, latitude, and longitude
startAccount(encToken, lat, lng)
.then((res) => {
console.log(res, 'Response');
})
.catch((e) => {
console.log(e, 'Error');
});💡Note: encToken is mandatory for initiating the Fino Suvidha Account Opening flow.
Response JSON Object
startAccount() Method Reponse
| Key | Type | | -------- | ------- | --- | | status | boolean | | response | number | | | message | string |
Contributing
License
MIT
