capacitor-sumsub-mobile-sdk
v0.0.6
Published
Sumsub SDK for Capacitor apps
Downloads
11
Readme
capacitor-sumsub-mobile-sdk
Sumsub SDK for Capacitor apps
Install
npm install capacitor-sumsub-mobile-sdk
npx cap syncAndroid
Add this to your repository build.gradle file:
allprojects {
repositories {
maven { url "https://maven.sumsub.com/repository/maven-public/" }
}
}iOS
Add this to your Podfile:
source 'https://github.com/SumSubstance/Specs.git'Permissions
iOS
Add the following keys to your Info.plist file:
<key>NSCameraUsageDescription</key>
<string>Let us take a photo</string>
<key>NSMicrophoneUsageDescription</key>
<string>Time to record a video</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Let us pick a photo</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Please provide us with your geolocation data to prove your current location</string>API
initialize(...)present()dismiss()setAccessToken(...)getVerificationStatus()addListener('onTokenExpired', ...)addListener('onVerificationStatusChanged', ...)addListener('onVerificationFailed', ...)addListener('onApprovedStatusChanged', ...)addListener('onEvent', ...)addListener('onApplicantLoaded', ...)addListener('onStepInitiated', ...)addListener('onStepCompleted', ...)addListener('onAnalyticsEvent', ...)addListener('onDidDismiss', ...)addListener('onLog', ...)- Interfaces
- Enums
initialize(...)
initialize(options: { accessToken: string; applicantConfig?: { email?: string; phone?: string; }; debug?: boolean; locale?: string; isAnalyticsEnabled?: boolean; }) => anyInitializes the SDK with the given access token and optional configuration.
| Param | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------- |
| options | { accessToken: string; applicantConfig?: { email?: string; phone?: string; }; debug?: boolean; locale?: string; isAnalyticsEnabled?: boolean; } | - The options for initializing the SDK. |
Returns: any
present()
present() => anyPresent the verification flow. This method should be called after the SDK is initialized.
Returns: any
dismiss()
dismiss() => anyReturns: any
setAccessToken(...)
setAccessToken(options: { token: string; }) => any| Param | Type |
| ------------- | ------------------------------- |
| options | { token: string; } |
Returns: any
getVerificationStatus()
getVerificationStatus() => anyReturns the current verification status.
If the verification flow is not presented, the status will be NOT_INITIALIZED or READY.
You need to present the verification flow to get the actual verification status.
Returns: any
addListener('onTokenExpired', ...)
addListener(eventName: 'onTokenExpired', listenerFunc: () => void) => any| Param | Type |
| ------------------ | ----------------------------- |
| eventName | 'onTokenExpired' |
| listenerFunc | () => void |
Returns: any
addListener('onVerificationStatusChanged', ...)
addListener(eventName: 'onVerificationStatusChanged', listenerFunc: (status: { prevStatus: SumsubSdkStatus; newStatus: SumsubSdkStatus; statusDescription: string; verboseStatus: string; failReason: string; }) => void) => anyThis event is triggered when the verification status changes.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| eventName | 'onVerificationStatusChanged' |
| listenerFunc | (status: { prevStatus: SumsubSdkStatus; newStatus: SumsubSdkStatus; statusDescription: string; verboseStatus: string; failReason: string; }) => void |
Returns: any
addListener('onVerificationFailed', ...)
addListener(eventName: 'onVerificationFailed', listenerFunc: (status: { failReason: string; }) => void) => anyThis event is triggered when the verification status changes to failed.
| Param | Type |
| ------------------ | --------------------------------------------------------- |
| eventName | 'onVerificationFailed' |
| listenerFunc | (status: { failReason: string; }) => void |
Returns: any
addListener('onApprovedStatusChanged', ...)
addListener(eventName: 'onApprovedStatusChanged', listenerFunc: (event: { isApproved: boolean; }) => void) => anyThis event is triggered when the approval changes to approved or rejected.
| Param | Type |
| ------------------ | --------------------------------------------------------- |
| eventName | 'onApprovedStatusChanged' |
| listenerFunc | (event: { isApproved: boolean; }) => void |
Returns: any
addListener('onEvent', ...)
addListener(eventName: 'onEvent', listenerFunc: (event: { eventName: string; payload: any; }) => void) => anyAll event notifications
| Param | Type |
| ------------------ | --------------------------------------------------------------------- |
| eventName | 'onEvent' |
| listenerFunc | (event: { eventName: string; payload: any; }) => void |
Returns: any
addListener('onApplicantLoaded', ...)
addListener(eventName: 'onApplicantLoaded', listenerFunc: (event: { applicantId: string; }) => void) => any| Param | Type |
| ------------------ | --------------------------------------------------------- |
| eventName | 'onApplicantLoaded' |
| listenerFunc | (event: { applicantId: string; }) => void |
Returns: any
addListener('onStepInitiated', ...)
addListener(eventName: 'onStepInitiated', listenerFunc: (event: { step: string; }) => void) => any| Param | Type |
| ------------------ | -------------------------------------------------- |
| eventName | 'onStepInitiated' |
| listenerFunc | (event: { step: string; }) => void |
Returns: any
addListener('onStepCompleted', ...)
addListener(eventName: 'onStepCompleted', listenerFunc: (event: { step: string; isCancelled: boolean; }) => void) => any| Param | Type |
| ------------------ | ------------------------------------------------------------------------ |
| eventName | 'onStepCompleted' |
| listenerFunc | (event: { step: string; isCancelled: boolean; }) => void |
Returns: any
addListener('onAnalyticsEvent', ...)
addListener(eventName: 'onAnalyticsEvent', listenerFunc: (event: { eventName: string; payload: any; }) => void) => any| Param | Type |
| ------------------ | --------------------------------------------------------------------- |
| eventName | 'onAnalyticsEvent' |
| listenerFunc | (event: { eventName: string; payload: any; }) => void |
Returns: any
addListener('onDidDismiss', ...)
addListener(eventName: 'onDidDismiss', listenerFunc: (event: { status: string; description: string; }) => void) => any| Param | Type |
| ------------------ | ------------------------------------------------------------------------- |
| eventName | 'onDidDismiss' |
| listenerFunc | (event: { status: string; description: string; }) => void |
Returns: any
addListener('onLog', ...)
addListener(eventName: 'onLog', listenerFunc: (event: { level: LogLevel; message: string; }) => void) => anyLogs all the messages from the SDK. Log level default is Error, can be change to debug when initializing the SDK.
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| eventName | 'onLog' |
| listenerFunc | (event: { level: LogLevel; message: string; }) => void |
Returns: any
Interfaces
PluginListenerHandle
| Prop | Type |
| ------------ | ------------------------- |
| remove | () => any |
Enums
SumsubSdkStatus
| Members | Value |
| -------------------------- | ---------------------------------- |
| NOT_INITIALIZED | 'NotInitialized' |
| READY | 'Ready' |
| FAILED | 'Failed' |
| INITIAL | 'Initial' |
| INCOMPLETE | 'Incomplete' |
| PENDING | 'Pending' |
| TEMPORARILY_DECLINED | 'TemporarilyDeclined' |
| FINALLY_REJECTED | 'FinallyRejected' |
| APPROVED | 'Approved' |
| ACTION_COMPLETED | 'ActionCompleted' |
LogLevel
| Members | Value |
| ------------- | ---------------------- |
| OFF | 'OFF' |
| ERROR | 'ERROR' |
| WARNING | 'WARNING' |
| INFO | 'INFO' |
| DEBUG | 'DEBUG' |
| TRACE | 'TRACE' |
| UNKNOWN | 'UNKNOWN' |
