Getting Started
Dieser Inhalt ist in Ihrer Sprache noch nicht verfügbar.
-
Install the package
Terminal-Fenster npm i @capgo/capacitor-personaTerminal-Fenster pnpm add @capgo/capacitor-personaTerminal-Fenster yarn add @capgo/capacitor-personaTerminal-Fenster bun add @capgo/capacitor-persona -
Sync native projects
Terminal-Fenster npx cap syncTerminal-Fenster pnpm cap syncTerminal-Fenster yarn cap syncTerminal-Fenster bunx cap sync
iOS Setup
Section titled “iOS Setup”Persona can require camera, location, and bluetooth depending on your inquiry template. Add usage descriptions in Info.plist:
<key>NSCameraUsageDescription</key><string>This app uses the camera for identity verification.</string><key>NSLocationWhenInUseUsageDescription</key><string>This app uses location to support identity verification.</string><key>NSBluetoothAlwaysUsageDescription</key><string>This app uses bluetooth to improve identity verification checks.</string>Android Setup
Section titled “Android Setup”No extra Java/Kotlin wiring is required. The plugin already configures Persona’s Android Maven repository and dependency.
Basic Usage
Section titled “Basic Usage”import { Persona } from '@capgo/capacitor-persona';
await Persona.addListener('inquiryComplete', (result) => { console.log('Inquiry complete', result.inquiryId, result.status);});
await Persona.addListener('inquiryCanceled', (result) => { console.log('Inquiry canceled', result.inquiryId, result.sessionToken);});
await Persona.addListener('inquiryError', (result) => { console.error('Inquiry error', result.error, result.errorCode, result.cause);});
await Persona.startInquiry({ templateId: 'itmpl_EXAMPLE', environment: 'sandbox', referenceId: 'user_123', fields: { name_first: 'Alex', is_verified_user: true, },});Resume an Existing Inquiry
Section titled “Resume an Existing Inquiry”When resuming a flow created on your backend, pass inquiryId with a valid sessionToken:
await Persona.startInquiry({ inquiryId: 'inq_123', sessionToken: 'usertok_abc', environment: 'production',});API Reference
Section titled “API Reference”startInquiry(options)
Section titled “startInquiry(options)”Launches Persona inquiry UI.
Key options:
templateId: Recommended for new inquiries.templateVersion: Use a specific template version.inquiryId+sessionToken: Resume an existing inquiry.environment:'production' | 'sandbox'(default:'production').fields: Key/value map to pre-write inquiry fields.
Events
Section titled “Events”inquiryComplete: Inquiry reached a completed state.inquiryCanceled: User exited the inquiry.inquiryError: Persona returned an unrecoverable error.
Best Practices
Section titled “Best Practices”-
Use webhooks for critical decisions
Treat client callbacks as UX signals. Base compliance or account decisions on Persona webhook events from your backend. -
Validate options before launch
Ensure you pass eithertemplateId,templateVersion, orinquiryId. -
Handle cancellation and errors
Always listen forinquiryCanceledandinquiryErrorso users can recover gracefully.
Platform Notes
Section titled “Platform Notes”- iOS: Requires usage descriptions in
Info.plistfor template-dependent checks. - Android: Uses Persona SDK v2 and launches inquiry via native activity contract.
- Web: Not supported; the web implementation throws an unavailable error.