@capgo/capacitor-persona
v8.2.5
Published
Capacitor plugin for launching Persona Inquiry flows on iOS and Android.
Readme
@capgo/capacitor-persona
🤖 Building with an AI coding agent? Install Capgo skills so Claude Code, Codex, Cursor, Copilot, or Gemini CLI know how to install and use
@capgo/capacitor-personain your Capacitor app:npx skills add Cap-go/capgo-skills. Then ask your agent: "Add @capgo/capacitor-persona to my Capacitor app and wire it up." Agent setup guides · Hosted MCP
Launch Persona Inquiry flows from Capacitor apps on iOS and Android. Use template IDs or resume existing inquiries, prefill fields, and listen for completion, cancel, and error events in JavaScript.
Built and maintained with AI
We build, improve and fix our plugins with heavy use of AI, so issues usually get fixed in under a day and pull requests get feedback the same day. A human still reviews, tests and merges 50+ pull requests daily.
- Most plugin issues get a fix pull request the same day, often within a couple of hours, and are usually resolved in one to two days.
- Every pull request goes through our AI review system, usually within minutes.
- Our AI pre-checks tests, code review, conventions and security, then a human reviews, tests and merges.
- A human, Martin, reviews, tests and merges 50+ pull requests every day.
- In the last 90 days, 95% of plugin issues were resolved.
Learn more about how we build with AI
What it covers
- Start a Persona Inquiry from a template ID, template version, or existing inquiry ID
- Prefill inquiry fields and set sandbox or production environment
- Receive
inquiryComplete,inquiryCanceled, andinquiryErrorevents in the WebView layer - Native Persona SDK integration on iOS (
PersonaInquirySDK23.x) and Android (com.withpersona.sdk2:inquiry2.x)
Install
You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-pluginsThen use the following prompt:
Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-persona` plugin in my project.If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
npm install @capgo/capacitor-persona
npx cap syncDocs: capgo.app/docs/plugins/persona/
Usage
import { Persona } from '@capgo/capacitor-persona';
await Persona.addListener('inquiryComplete', (result) => {
console.log('Persona complete', result.inquiryId, result.status, result.fields);
});
await Persona.addListener('inquiryCanceled', (result) => {
console.log('Persona canceled', result.inquiryId, result.sessionToken);
});
await Persona.addListener('inquiryError', (result) => {
console.error('Persona error', result.error, result.errorCode);
});
await Persona.startInquiry({
templateId: 'itmpl_EXAMPLE',
environment: 'sandbox',
referenceId: 'user_123',
fields: {
name_first: 'Alex',
age: 29,
is_verified_user: true,
},
});Use Persona webhooks on your backend for authoritative verification status. SDK callbacks are best for UX, not compliance decisions.
iOS setup
- Run
npx cap sync ios. - Ensure the iOS deployment target is 15.0 or newer (matches the plugin podspec and
Package.swift). - Build with Xcode 26.2 or newer. Persona 3.x ships as a binary XCFramework whose Swift interface is produced by a current Swift 6 toolchain; older Xcode releases are not verified.
- Add usage descriptions to
ios/App/App/Info.plist. Persona requires camera and location strings for every template, and microphone when a template records video:
<key>NSCameraUsageDescription</key>
<string>We use the camera to verify your identity.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We use your location during identity verification.</string>
<key>NSMicrophoneUsageDescription</key>
<string>We use the microphone when a verification records video.</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>We use Bluetooth during identity verification when required.</string>Templates that use NFC additionally need NFCReaderUsageDescription, the NFC Tag Reading capability, and the ISO7816 application identifiers listed in Persona's iOS integration guide.
- Dependency resolution: Swift Package Manager projects (the Capacitor 8 default) resolve
inquiry-ios-2at exactly 3.11.0 through the pluginPackage.swift. CocoaPods projects resolve thePersonaInquirySDK23.11.0 pod (Persona resumed CocoaPods publishing with 3.8.0).
Android setup
- Run
npx cap sync android. - In the app root
android/build.gradle, add Persona's Maven repository so Gradle can resolve the inquiry SDK:
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://sdk.withpersona.com/android/releases' }
}
}- The plugin library targets minSdk 24 and depends on
com.withpersona.sdk2:inquiry(default 2.59.1, overridable withpersonaInquiryVersionin Gradle). Versions 2.56.0 and newer are published to Maven Central only; the Persona Maven repository above still serves older pins.
Upgrading from 8.1.x
Plugin 8.2.0 moves iOS to Persona Inquiry SDK 3.11.0 and Android to 2.59.1. No JavaScript changes are required.
inquiryErrorevents on iOS now includeerrorCode(andcausefor misconfigured inquiries); seeInquiryErrorInfobelow.localenow works together withtemplateVersionon iOS.- On iOS, an invalid
templateVersionis now reported throughinquiryError(errorCode: "misconfigured") instead of rejecting thestartInquirypromise, matchingtemplateIdand Android. - iOS builds need Xcode 26.2 or newer.
- Persona removed client-side theming in SDK 3; configure appearance in the Persona Dashboard Theme Editor.
API
startInquiry(...)addListener('inquiryComplete', ...)addListener('inquiryCanceled', ...)addListener('inquiryError', ...)removeAllListeners()- Interfaces
- Type Aliases
startInquiry(...)
startInquiry(options: StartInquiryOptions) => Promise<void>Launch a Persona Inquiry flow.
| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| options | StartInquiryOptions |
addListener('inquiryComplete', ...)
addListener(eventName: 'inquiryComplete', listenerFunc: (info: InquiryCompleteInfo) => void) => Promise<PluginListenerHandle>Listen for successful completion.
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------- |
| eventName | 'inquiryComplete' |
| listenerFunc | (info: InquiryCompleteInfo) => void |
Returns: Promise<PluginListenerHandle>
addListener('inquiryCanceled', ...)
addListener(eventName: 'inquiryCanceled', listenerFunc: (info: InquiryCanceledInfo) => void) => Promise<PluginListenerHandle>Listen for cancellation.
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------- |
| eventName | 'inquiryCanceled' |
| listenerFunc | (info: InquiryCanceledInfo) => void |
Returns: Promise<PluginListenerHandle>
addListener('inquiryError', ...)
addListener(eventName: 'inquiryError', listenerFunc: (info: InquiryErrorInfo) => void) => Promise<PluginListenerHandle>Listen for unrecoverable errors.
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | 'inquiryError' |
| listenerFunc | (info: InquiryErrorInfo) => void |
Returns: Promise<PluginListenerHandle>
removeAllListeners()
removeAllListeners() => Promise<void>Remove all registered listeners for this plugin instance.
Interfaces
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
InquiryCompleteInfo
Payload emitted when an Inquiry is completed.
| Prop | Type |
| --------------- | ----------------------------------------------------------------------------------------------------------------------- |
| inquiryId | string |
| status | string |
| fields | Record<string, PersonaResultFieldValue> |
InquiryCanceledInfo
Payload emitted when an Inquiry is canceled.
| Prop | Type |
| ------------------ | ------------------- |
| inquiryId | string |
| sessionToken | string |
InquiryErrorInfo
Payload emitted when an Inquiry errors.
| Prop | Type | Description |
| --------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| error | string | Human-readable description from the Persona SDK. |
| errorCode | string | Stable, platform-specific code. iOS (Persona SDK 3.x) emits the PersonaError case name: networking, invalidSessionToken, oneTimeLinkCodeInvalid, rateLimitExceeded, camera, gps, permissions, misconfigured, other, or unknown for cases added by a newer SDK. Android (Persona SDK 2.x) emits the SDK ErrorCode enum name, for example NetworkError, CameraPermissionError, SdkConfigurationError, SessionTokenError, RateLimitExceeded, InvalidOneTimeLinkCode, UnexpectedError. |
| cause | string | Additional detail when available. On iOS this is the InquiryConfigurationError description for misconfigured errors; on Android it is the SDK cause string. |
Type Aliases
StartInquiryOptions
Input payload used to launch an Inquiry.
Provide exactly one of inquiryId, templateId, or templateVersion.
StartInquirySharedOptions & ( | { /** * Existing Inquiry ID created on your backend. / inquiryId: string; templateId?: never; templateVersion?: never; } | { /* * Inquiry template ID from Persona Dashboard (recommended). / templateId: string; inquiryId?: never; templateVersion?: never; } | { /* * Inquiry template version ID from Persona Dashboard. * * Validated by the Persona SDK: an invalid value is reported through * inquiryError (errorCode: "misconfigured" on iOS) rather than by * rejecting the startInquiry promise. */ templateVersion: string; inquiryId?: never; templateId?: never; } )
StartInquirySharedOptions
{ /** * Session token required when resuming an existing Inquiry. / sessionToken?: string; /* * Your internal user reference. / referenceId?: string; /* * Persona account ID. / accountId?: string; /* * Persona environment. * * @default 'production' / environment?: PersonaEnvironment; /* * Locale override, for example en, fr, es. * * Supported with inquiryId, templateId, and templateVersion on both platforms * (iOS support for templateVersion requires plugin 8.2.0 or newer). / locale?: string; /* * Optional fields pre-written into the Inquiry. */ fields?: Record<string, PersonaFieldValue>; }
PersonaEnvironment
Environment where Persona should run.
'production' | 'sandbox'
Record
Construct a type with a set of properties K of type T
{ [P in K]: T; }
PersonaFieldValue
Supported field value types for pre-writing Inquiry fields.
string | number | boolean | string[]
PersonaResultFieldValue
Serialized field value returned in Inquiry result callbacks.
string | number | boolean | string[] | null
