The Document Capture module captures a supplementary document, such as a proof of address document, medical document, or bank statement. Users can upload a file or take a photo of the document with their device’s camera. For some document types, the server performs OCR and returns the extracted data.
For an overview of this module and how it works, see Document Capture.
How you use this module depends on your integration pattern. When the app defines the steps in code, you add the module to an IncdOnboardingFlowConfiguration as shown below; when the flow is defined in Dashboard, you reference it and let the back end drive the steps. See Integration Approaches.
Availability: All variants.
UI: v1 and v2
Add Document Capture
Add the module with addDocumentScan().
flowConfig.addDocumentScan(
showTutorials: true,
showDocumentProviderOptions: true,
documentType: .addressStatement,
showRetakeScreen: true,
isSkippable: false,
documentSources: [.camera, .photoUpload, .fileUpload]
)
Configuration Options
Configure the module with addDocumentScan().
| Option | Type | Description |
|---|---|---|
documentType |
DocumentType |
Sets the type of document the module looks for: for example, .addressStatement, .paymentProof, .medicalDoc, .creditCard, or .otherDocument1….otherDocument3. |
documentSources |
Set<DocumentSource>? |
Specifies the upload method for the document: .camera, .photoUpload, or .fileUpload. .fileUpload is only for PDF-capable types. supportPDF is false for .medicalDoc and .creditCard. See Document Upload. |
showTutorials |
Bool? |
Shows tutorials on how to capture the document. |
showRetakeScreen |
Bool? |
Offers a retake screen after manual capture. Default: true. |
isSkippable |
Bool |
Allows skipping. Default: false. |
showDocumentProviderOptions |
Bool? |
Allows the user to choose between using the camera to scan the document and uploading its file. UI v1 only. Default: true. |
Result
func onDocumentScanCompleted(_ result: DocumentScanResult)
DocumentScanResult fields:
documentImage: UIImage?data: Data?mimeType: String?documentType: DocumentTypeinsuranceCardData: OmniGetMedicalOCRDataResponse?addressFieldsFromPoa: OCRDataAddress?error: DocumentScanError?
OCR data maps to the field that matches the captured documentType:
addressFieldsFromPoais populated for.addressStatement.insuranceCardDatais populated for medical and insurance-card captures.- Fields that do not apply to the captured type are
nil.
Errors
DocumentScanError cases:
errorpermissionsDenieduploadErrorinvalidConfiguration
Document Upload
Document Upload is not a standalone module on iOS. It is enabled as part of Document Capture.
ID documents have their own upload path: addIdScan(..., digitalIdsUpload: true) lets users upload an existing digital ID (PDF). See ID Capture.
Availability: All variants (same as Document Capture).
UI: v1 and v2.
Add Document Upload
Enable Document Upload by including upload sources in the documentSources set.
flowConfig.addDocumentScan(
documentType: .addressStatement,
documentSources: [.photoUpload, .fileUpload] // omit .camera to make it upload-only
)
.camera: Enable the user to capture an image of the document..photoUpload: Enable the user to pick an image from the photo library..fileUpload: Enable the user to pick a PDF file. This is only available for document types that support PDFs.
Combine .photoUpload, .fileUpload, or both with .camera to offer both live capture and upload.
Result
The result is delivered through the same onDocumentScanCompleted(_:) callback and DocumentScanResult as Document Capture.