System Requirements
- React Native 0.60 or higher
- iOS 14.0 or higher
- Android API level 21 (Android 5.0) or higher
- For Expo projects: Expo SDK 45 or higher with custom development client
- SDK Size: ~90 KB (plus native iOS and Android SDK dependencies)
Installation
Using NPM
Using Yarn
Android Configuration
If an exception occurs during the build stating that theai.verisoul:android package cannot be downloaded, add the following Maven repository inside your android/build.gradle file:
Expo Projects
Note: Requires custom development client (not supported in Expo Go)1. Install expo-dev-client:
app.json: add the plugin and set newArchEnabled to true
Usage
Initialize the SDK
Theconfigure() method initializes the Verisoul SDK with your project credentials. Call configure() before you intend to retrieve a Verisoul session_id — only initialize the SDK if you plan to call the Verisoul API for that session.
Parameters:
environment: The environment to useVerisoulEnvironment.prodfor production orVerisoulEnvironment.sandboxfor testingprojectId: Your unique Verisoul project identifier
getSessionId()
ThegetSessionID() method returns the current session identifier after the SDK has collected sufficient device data. This session ID is required to request a risk assessment from Verisoul’s API.
Important Notes:
- Session IDs are short-lived and expire after 24 hours
- The session ID becomes available once minimum data collection is complete (typically within seconds)
- You should send this session ID to your backend, which can then call Verisoul’s API to get a risk assessment
- A new session ID is generated each time the SDK is initialized
On iOS, the SDK collects data only while the app is in the foreground. If
getSessionID() is called while the app is in the background (for example during a silent push, background fetch, or location update), it returns once the user opens the app. A cached session is returned right away, and the timeout counts only time spent in the foreground. Don’t await getSessionID() inside background handlers or in other code that has to finish while the app is in the background.Provide Touch Events
Touch event data is collected and analyzed to detect automated/bot behavior by comparing touch patterns with device sensor data. This helps identify anomalies that may indicate fraud. React Native Setup: Wrap your root component withVerisoulTouchRootView to automatically capture touch events across both iOS and Android:
iOS Configuration
For iOS-specific configuration including Device Check and App Attest setup, please refer to the iOS SDK Documentation.Error Codes
The SDK throwsVerisoulException with the following error codes:
Exception Structure
All errors are thrown asVerisoulException with the following properties:
