SDKs overview
Persona offers a suite of Software Development Kits (SDKs) designed to facilitate the integration of its identity verification platform into various applications. These SDKs abstract much of the complexity involved in managing verification flows, capturing user data, and interacting with Persona's backend services. They are available for common development environments, enabling developers to embed identity verification directly into their user onboarding or transaction processes without needing to build custom UI components or handle intricate API calls manually.
The SDKs are engineered to support Persona's key offerings, including Identity Verification, Know Your Customer (KYC), Anti-Money Laundering (AML), and fraud prevention. By leveraging these SDKs, developers can implement dynamic verification workflows that adapt to different risk profiles and regulatory requirements, such as those outlined by FinCEN's AML Act. This approach aims to reduce the time and resources required for integration while ensuring compliance and a consistent user experience across different platforms.
Each SDK provides specific functionalities tailored to its respective platform, such as native UI components for mobile environments and JavaScript libraries for web applications. This allows for platform-idiomatic integrations that feel natural to the end-user. The SDKs also handle secure data transmission, session management, and error handling, which are critical for maintaining data integrity and application stability during the verification process. Persona's API reference documentation provides further details on the underlying API interactions managed by the SDKs.
Official SDKs by language
Persona provides official SDKs for major development platforms, ensuring direct support and ongoing maintenance. These SDKs are the recommended method for integrating Persona into applications, offering a streamlined development experience and access to the latest features. The table below outlines the officially supported SDKs, their respective package names, installation methods, and current maturity status.
| Language/Platform | Package/Module | Installation Command | Maturity |
|---|---|---|---|
| iOS (Swift/Objective-C) | Persona (CocoaPods) |
pod 'Persona' |
Stable |
| Android (Kotlin/Java) | com.withpersona.sdk:persona (Gradle) |
implementation 'com.withpersona.sdk:persona:+' |
Stable |
| React Native | @persona/react-native (npm/yarn) |
npm install @persona/react-native or yarn add @persona/react-native |
Stable |
| Web (JavaScript) | @persona/client (npm/yarn) |
npm install @persona/client or yarn add @persona/client |
Stable |
Each SDK is designed to be idiomatic to its platform, providing native user experiences where appropriate. For example, the iOS and Android SDKs offer pre-built UI components that conform to platform design guidelines, while the Web SDK provides a flexible JavaScript interface for embedding verification flows directly into web pages. The official documentation for Persona Mobile SDKs and Persona Web SDK provides detailed integration instructions and API references for each.
Installation
Installing Persona's SDKs typically involves adding a dependency to your project's configuration file and then importing the necessary modules into your code. The specific steps vary depending on the platform and package manager used.
iOS SDK Installation
For iOS projects, the Persona SDK is commonly installed using CocoaPods, a dependency manager for Swift and Objective-C Cocoa projects. First, ensure CocoaPods is installed on your system. Then, navigate to your project directory and open your Podfile. Add the Persona pod as follows:
platform :ios, '12.0'
use_frameworks!
target 'YourAppTarget' do
pod 'Persona'
end
After saving the Podfile, run pod install in your terminal within the same directory. This command will install the Persona SDK and integrate it into your Xcode workspace.
Android SDK Installation
For Android projects, the Persona SDK is distributed via Maven Central and can be added as a dependency in your app's build.gradle file. Open your module-level build.gradle (usually app/build.gradle) and add the following to the dependencies block:
dependencies {
implementation 'com.withpersona.sdk:persona:+'
}
After adding the dependency, sync your Gradle project to download and integrate the SDK. Ensure your project's minSdkVersion meets the requirements specified in the Android SDK documentation.
React Native SDK Installation
The Persona React Native SDK can be installed using npm or yarn. Navigate to your React Native project directory in your terminal and execute one of the following commands:
npm install @persona/react-native
# or
yarn add @persona/react-native
After installation, you may need to link native modules, although many modern React Native setups handle this automatically. For older React Native versions or specific configurations, you might run npx react-native link @persona/react-native. Consult the React Native SDK guide for any platform-specific linking requirements.
Web SDK Installation
The Persona Web SDK is typically installed via npm or yarn for modern web development workflows. In your project's root directory, run:
npm install @persona/client
# or
yarn add @persona/client
Alternatively, for simpler setups or quick prototyping, you can include the Web SDK directly via a script tag from a Content Delivery Network (CDN). However, for production applications, using a package manager is generally recommended for better dependency management and build process integration. The Web SDK quickstart provides CDN options.
Quickstart example
This quickstart example demonstrates how to integrate the Persona Web SDK into a basic HTML page to initiate an inquiry. This setup assumes you have obtained a Persona templateId and an inquiryId (or are generating one on the client side, though server-side generation is recommended for security). For a complete and secure integration, always refer to Persona's official documentation and consider server-side generation of Inquiry IDs and client tokens.
Web SDK Quickstart
First, include the Persona client library in your HTML file. If you installed via npm/yarn, your build process will handle this. For a direct CDN approach:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Persona Verification</title>
<script src="https://cdn.withpersona.com/sdk/persona-3.0.0.js"></script>
</head>
<body>
<h1>Verify Your Identity</h1>
<button id="verifyButton">Start Verification</button>
<script>
document.getElementById('verifyButton').addEventListener('click', () => {
// Replace 'YOUR_TEMPLATE_ID' with your actual Persona Template ID
// You can find this in your Persona Dashboard under Integrations -> Templates
const templateId = 'YOUR_TEMPLATE_ID';
// For production, inquiryId and clientSessionToken should be securely generated on your server
// and passed to the client. This example uses client-side generation for simplicity.
// Refer to Persona's server-side integration guide for best practices.
const client = new Persona.Client({
templateId: templateId,
environment: 'sandbox', // Use 'production' for live applications
onComplete: ({ inquiryId, status, fields }) => {
console.log('Verification completed!');
console.log('Inquiry ID:', inquiryId);
console.log('Status:', status);
console.log('Fields:', fields);
alert(`Verification complete! Status: ${status}`);
// Here, you would typically send inquiryId to your backend for server-side verification
},
onCancel: () => {
console.log('Verification cancelled.');
alert('Verification cancelled.');
},
onError: (error) => {
console.error('Verification error:', error);
alert('Verification failed: ' + error.message);
}
});
client.open();
});
</script>
</body>
</html>
This example initializes the Persona client with a specified templateId and defines callback functions for when the verification process is completed, cancelled, or encounters an error. The environment parameter should be set to 'production' for live deployments. For robust security, Persona recommends generating the inquiryId and a clientSessionToken on your backend and passing them to the client-side SDK. This prevents unauthorized access and ensures the integrity of the verification process.
Community libraries
While Persona maintains official SDKs for primary platforms, the developer community may also contribute open-source libraries or integrations that extend Persona's functionality or provide wrappers for less commonly supported languages or frameworks. These community-driven efforts can offer alternative approaches or specialized tools, though they typically do not receive official support from Persona.
Developers interested in community libraries should exercise due diligence, reviewing the project's source code, license, and maintenance status. Contributions often appear on platforms like GitHub. As of now, Persona's primary focus is on its officially supported SDKs for mobile and web environments. For languages like Python, Ruby, or Node.js, direct API integration using standard HTTP client libraries is common, as Persona's API is RESTful and well-documented, making it accessible even without dedicated SDKs for server-side operations. This aligns with common practices for integrating RESTful APIs in various backend programming languages.
When considering a community library, it is advisable to check its compatibility with the latest Persona API versions and to understand its security implications, especially when handling sensitive identity data. For critical applications, relying on the officially supported SDKs or direct API integration with robust error handling and security practices is generally the most secure and reliable approach.