Identity Verification Module
Privo.verification.showVerification(profile: UserVerificationProfile) {
(verificationEvents: [VerificationEvent]) in
}
Used to show PRIVO Verification Modal Dialog
UserVerificationProfile - optional user predefined profile
public struct UserVerificationProfile: Encodable {
public var firstName: String?
public var lastName: String?
public var birthDateYYYYMMDD: String? // Optional date string in the "yyyy-MM-dd" date-format
public var email: String?
public var postalCode: String?
public var phone: String? // Optional phone number in E.164 format. Example: "+12133734253"
public var partnerDefinedUniqueID: String? // Optional unique identifier passed by Partner and returned in all responses by PRIVO.
}
completion - closure which used to handle the result of an asynchronous operation and takes as input argument array of VerificationEvent instancies.
public struct VerificationEvent: Decodable, Hashable {
public let event: VerificationEventType // the event type. Can be: verifyInitialized, verifyError, verifyCancel, verifyComplete, verifyDone
public let result: VerificationResult? // verification result data from PRIVO
public let data: String? // The string representation of result object.
public let errorCode: String? // Error Code
public let errorMessage: String? // Error message
}
Verification Events:
verifyInitialized - When the verification widget has initialized.
verifyCancel - When user has canceled the verification.
verifyComplete - When user has successfully completed the verification process and has been verified.
verifyDone - When the user has completed the verification and closed the verification widget.
verifyError - If an error occurs. See Error Codes section.
verifyPrintPreview
Possible Error Codes:
Error Code | Error Message |
---|---|
10001 | Invalid API Key or access_token |
10002 | Missing site_id parameter |
10003 | Unexpected error |
10100 | Invalid email address |
10101 | Misconfigured verification methods |
412 | Too many attempts |
public struct VerificationResult: Decodable, Hashable {
public let serviceId: String? // If the user has opted to save their verification status by adding a password, then a serviceId will be generated
public let verificationResponse: VerificationResponse // Verification response data
}
public struct VerificationResponse: Decodable, Hashable {
public let verified: Bool // user verification status
public let requestID: String // Unique identifier for the verification request. The partner should retain this value for traceability.
public let transactionID: String // Unique identifier for the transaction. Partner can retain this value for traceability.
public let verificationMethod: VerificationMethodType // The verification method chosen by the user. Possible values: CreditCard, DriversLicense, SSN, CorporateEmail, PrintForm, Phone
public let matchOutcome: VerificationOutcome // Specific outcome for the verification request. Possible values: Pass, Pending (when the user has chosen an offline method of verification, such as Phone or PrintForm, matchOutcome will be ‘Pending’).
public let requestTimestamp: Date // Date of the completed verification request.
public let locale: String // Location of the user as defined by their browser settings.
public let matchCode: String? // A code that identifies the field groups that are matched in the verification request. May be nil.
public let redirectUrl: String? // Return URL address passed by partner to send the user directly following onVerifyDone event. May be nil.
public let message: String? // For debug reasons - if error occurs error message will be provided here. May be nil.
public let partnerDefinedUniqueID: String? // Value passed by partner in config of the verification request. PRIVO returns this value in the onVerifyComplete event. Can be nil.
//Applicable to offline methods only
public let identificationNumber: String? // nique number provided to user when an offline verification method is chosen. This value can be used by Partner and PRIVO to identify the given pending request.
public let attemptId: Int? // Identifier used to notate the attempt request.
public let requestIdentifier: String
}
Method to get status of the current user (can be configured to be blocked after N attempts)
Privo.verification.getUserLimits(externalYserId: String) { limits in }
response: UserLimits - User Limits Information
public struct UserLimits: Decodable, Encodable, Hashable {
public let isOverLimit: Bool
public let limitType: LimitType
public let retryAfter: Int?
}
public enum LimitType: String, Codable {
case IV
case Auth
}
Identity Verification SDK example
let profile = UserVerificationProfile(
firstName: "{{value}}",
lastName: "{{value}}",
birthDateYYYYMMDD: "1970-01-01",
email: "{{value}}",
postalCode: "{{value}}",
phone: "{{value}}",
partnerDefinedUniqueID: "{{value}}",
)
Privo.verification.showVerificationModal(profile) {
verificationEvents in
for verificationEvent in verificationEvents {
verificationEvent.event
verificationEvent.result
verificationEvent.data
verificationEvent.errorCode
verificationEvent.errorMessage
}
}
Identity Verification Module Swift UI Components
PrivoVerificationButton(label: {
Text("Show Verification")
}, onFinish: {
events in
self.events = events
}, profile: nil).padding()