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
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
The Verisoul SDK is not supported in Expo Go. If you are using the managed workflow, you will need to use Expo’s custom development client.- Install expo-dev-client:
- Modify the scripts section in your
package.jsonfile:
- Install Verisoul SDK:
- If needed, add the Maven repository to your
android/build.gradlefile as shown in the Android Configuration section above.
Usage
Initialize the SDK
Theconfigure() method initializes the Verisoul SDK with your project credentials. This method must be called once when your application starts.
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 or when
reinitialize()is called
reinitialize()
Thereinitialize() method generates a fresh session ID and resets the SDK’s data collection. This is essential for maintaining data integrity when user context changes.
Example:
getSessionID() to retrieve the new session identifier.
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:
| Error Code | Description | Recommended Action |
|---|---|---|
| INVALID_ENVIRONMENT | The environment parameter passed to Verisoul.configure() is invalid. Valid values are “dev”, “sandbox”, or “prod”. | Ensure the environment parameter is exactly “dev”, “sandbox”, or “prod” (case-sensitive, no whitespace). |
| SESSION_UNAVAILABLE | A valid session ID could not be obtained. This typically occurs when Verisoul’s servers are unreachable due to network blocking or a very slow connection. | Implement exponential backoff. Prompt user to check network or disable network blocker. |
| WEBVIEW_UNAVAILABLE | WebView is not available on the device. This can occur when WebView is disabled, missing, uninstalled, or corrupted on the device. | Prompt user to enable WebView in settings, update Android System WebView, or switch devices. |
Exception Structure
All errors are thrown asVerisoulException with the following properties:
| Property | Type | Description |
|---|---|---|
| code | String | One of the error codes above |
| message | String | Human-readable error description |
| cause | Throwable? | The underlying exception that caused the error (if any) |
