Usage & Interface
- iOS
- Android
- Capacitor
- React Native
- Flutter
- .NET
1. Launch the Lens camera:
VeryfiLens.shared().showCamera(in: self)
2. Optionally, instead of launching the Lens camera experience, you may perform one of the following:
- Launch the Gallery screen to submit images from the Photo Gallery:
VeryfiLens.shared().showGallery(in: self)
- Launch the Files Browser screen to submit documents:
VeryfiLens.shared().showDocumentBrowser(in: self)
- Retry uploading specific package:
VeryfiLens.shared().utils.retryPackage(with: packageId)
- Retry uploading all packages currently in queue
VeryfiLens.shared().utils.retryAllPackages()
- Remove specific package from the queue
VeryfiLens.shared().utils.discardPackage(with: packageId)
- Remove all packages from the queue
VeryfiLens.shared().utils.discardAllPackages()
- Share OCR feedback for last scan
VeryfiLens.shared().shareOCRFeedback()
1. Manage the Lens experience:
- Enable buffer processing which starts detection of documents
VeryfiLensHeadless.shared().startProcessingBuffer()
- Process a frame buffer to see if there's any document
VeryfiLensHeadless.shared().processWithBlock(buffer: frame) { rectangles, buffer in
// Call adjustedRectangles like this to change corner values that you can use on your camera view to draw
let convertedRectangles = VeryfiLensHeadless.shared().adjustedRectangles(
rectangles,
for: buffer,
videoPreviewLayer: cameraView.previewLayer // set your camera previwLayer
)
// Draw some borders with the rectangles object
}
- Disable buffer processing which stops/pauses detection of documents
VeryfiLensHeadless.shared().stopProcessingBuffer()
- Returns adjusted corners of detected documents in camera (intended for those who want to draw over those coordinates)
VeryfiLensHeadless.shared().adjustedRectangles(
_ rectangles: [RectangleFeature],
for buffer: CMSampleBuffer,
videoPreviewLayer: AVCaptureVideoPreviewLayer) -> [RectangleFeature]
- Reset lens state
VeryfiLensHeadless.shared().reset()
- Close lens (Call this whenever you want to reset the autocapture process after document detection)
VeryfiLensHeadless.shared().close()
2. Optionally, you may use the following at your convenience:
- Crop image (this method will return an empty [UIImage] array if no suitable corners where found to crop aka. no document detected)
VeryfiLensHeadless.shared().crop(image: rotatedImage) { [weak self] croppedImages in
// Use the croppedImages UIImage array
}
- Rotate image
VeryfiLensHeadless.shared().rotate(image: UIImage) -> UIImage
- Upload images
VeryfiLensHeadless.shared().upload(images: [UIImage])
- Uploads a document without UI
VeryfiLensHeadless.shared().upload(url: URL)
- Update lens settings
VeryfiLensHeadless.shared().updateSettings(_ settings: VeryfiLensHeadlessReceipts.VeryfiLensHeadlessSettings)
3. For all of the above features, your app will need to communicate with Lens to handle user actions, various status changes and extraction results from Veryfi. See the Communicating with Lens section below for details
1. Launch the Lens camera:
VeryfiLens.showCamera()
2. Optionally, instead of launching the Lens camera experience, you may perform one of the following:
- Launch the Gallery screen to submit images from the Photo Gallery:
VeryfiLens.showGallery()
- Launch the File Explorer screen to submit images and PDF files from the Photo Gallery:
VeryfiLens.showDocumentBrowser()
- Retry uploading specific package:
VeryfiLens.retryUpload(packageId: String)
- Retry uploading all packages currently in queue
VeryfiLens.retryAll()
- Remove specific package from the queue
VeryfiLens.discardUpload(packageId: String)
- Remove all packages from the queue
VeryfiLens.discardAll()
- Share OCR feedback for last scan
VeryfiLens.shareOCRFeedback()
3. For all of the above features, with the exception of showEmail(), your app will need to communicate with Lens to handle user actions, various status changes and extraction results from Veryfi. See the Communicating with Lens section below for details
1. Launch the Lens camera:
VeryfiLensCapacitor.showCamera()
2. Optionally, instead of launching the Lens camera experience, you may perform one of the following:
- Retry uploading specific package:
VeryfiLensCapacitor.retryPackage(options: { packageID: String, metadata: Object, imageSourceTag: String })
- Retry uploading all packages currently in queue
VeryfiLensCapacitor.retryAllPackages()
- Remove specific package from the queue
VeryfiLensCapacitor.discardPackage(options: { packageID: String })
- Remove all packages from the queue
VeryfiLensCapacitor.discardAll()
- Share OCR feedback for last scan
VeryfiLensCapacitor.shareOCRFeedback()
This function call launches the Veryfi Lens camera experience to allow users to capture and submit documents.
VeryfiLens.showCamera();
If you want to show the camera right after configuring Lens you need to use the following logic to wait for the configure process to finish
VeryfiLens.configureWithCredentials(
veryfiLensCredentials,
veryfiLensSettings,
() => {
VeryfiLens.showCamera();
},
);
You can also launch experiences like showGallery and showDocumentBrowser after configuring Lens:
To show Gallery:
VeryfiLens.showGallery();
To show Document browser:
VeryfiLens.showDocumentBrowser();
- Share OCR feedback for last scan
VeryfiLens.shareOCRFeedback()
1. Launch the Lens camera:
Veryfi.showCamera()
2. Optionally, instead of launching the Lens camera experience, you may perform one of the following:
- Retry uploading specific package:
Veryfi.retryPackage(String packageID, Map<String, Object> metadata, String imageSourceTag)
- Retry uploading all packages currently in queue
Veryfi.retryAllPackages()
- Remove specific package from the queue
Veryfi.discardPackage(String packageID)
- Remove all packages from the queue
Veryfi.discardAll()
- Share OCR feedback for last scan
Veryfi.shareOCRFeedback()
1. After configuring Lens with your credentials assign your event handler in Veryfi Lens:
- iOS: Create a strong property reference (To avoid issues like veryfi delegate events not triggering):
VeryfiLensDelegateListener _veryfiLensDelegate;
Then instanciate it and assign it:
_veryfiLensDelegate = new VeryfiLensDelegateListener(this);
VeryfiLens.Shared.Delegate = _veryfiLensDelegate;
- Android:
VeryfiLens.SetDelegate(new VeryfiLensDelegateListener());
2. Launch the Lens camera:
- iOS:
VeryfiLens.Shared.ShowCameraIn(this);
We recommend calling ConfigureWithCredentials and defining VeryfiLensDelegate in the ViewDidLoad method and calling the ShowCameraInViewController on a user initiated action so Lens has time to set up.
- Android:
VeryfiLens.ShowCamera();
You'll still need to configure the communication steps to start receiving events from Lens. So please refer to that section.