Configuration Options
The SDK accepts a configuration object during initialization with the following options:
Core Settings
Option | Type | Default | Description |
---|---|---|---|
lensFlavor | string | Required | Determines scanning experience type: - 'document' : Receipts & Invoices scanning- 'long_document' : Long Receipts scanning- 'credit_card' : Credit card scanning- 'checks' : Check scanning (front/back)- 'upload' : File upload only |
container | string | undefined | HTML element ID where lens will mount. Creates full-screen overlay if not specified |
debug_mode | boolean | false | Enables debug logging to console |
Document Processing
Option | Type | Default | Description |
---|---|---|---|
detectScreenCapture | boolean | false | Enables detection of screen capture attempts |
enforceBothSides | boolean | false | Enforces capture of both sides of documents |
enforceAndSkipBothSides | boolean | false | Enforces both sides capture but skips the dialog |
delayBetweenCaptures | number | 0 | Delay in milliseconds between front and back capture |
enforceDocumentDetection | boolean | false | Forces document detection validation |
enforceBlurDetection | boolean | false | Forces blur detection validation |
UI Elements
Option | Type | Default | Description |
---|---|---|---|
torchButton | boolean | false | Adds flashlight toggle button (requires device support) |
exitButton | boolean | false | Adds button to close camera view |
blurModal | boolean | false | Shows warning when blur detected |
isDocumentModal | boolean | false | Shows warning when no document detected |
enableSubmit | boolean | true | Shows submit button after successful capture |
Special Features
Option | Type | Default | Description |
---|---|---|---|
captureBackOfCheck | boolean | false | Enables back side capture for checks (requires lensFlavor: 'checks' ) |
enableLongReceiptPreview | boolean | false | Shows preview during receipt stitching (requires lensFlavor: 'long_document' ) |
Text Customization
Option | Type | Default | Description |
---|---|---|---|
documentModalMessage | string | 'Oops, There appears to be no document on your image' | Custom message for document detection modal |
blurModalMessage | string | 'Oops, The image is too blurry to process' | Custom message for blur detection modal |
submitButtonText | string | 'Submit Anyway' | Custom text for submit button |
retakeButtonText | string | 'Retake a picture' | Custom text for retake button |
cropButtonText | string | 'Crop' | Custom text for crop button |
resetButtonText | string | 'Reset' | Custom text for reset button |
dropZoneText | string | 'Click or drag and drop to upload an image' | Custom text for upload drop zone (requires lensFlavor: 'upload' ) |
checkEnforcedModalMessage | string | 'Please flip the check and capture the back side' | Custom message when back check capture is required (requires lensFlavor: 'checks' and enforceBothSides: true ) |
checkOptionalModalMessage | string | 'Do you want to capture the back side of the check?' | Custom message when back check capture is optional (requires lensFlavor: 'checks' and captureBackOfCheck: true ) |
checkContinueButtonText | string | 'Continue' | Custom text for check continue button (requires lensFlavor: 'checks' and enforceBothSides: true ) |
checkYesButtonText | string | 'Yes' | Custom text for check confirmation button (requires lensFlavor: 'checks' ) |
checkNoButtonText | string | 'No' | Custom text for check rejection button (requires lensFlavor: 'checks' ) |
Navigation & Callbacks
Option | Type | Default | Description |
---|---|---|---|
onCloseRedirectUrl | string | undefined | URL to redirect to when exit pressed |
onClose | function | undefined | Callback when camera view closes:(isVisible: boolean) => void |
Usage Example
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
statusIndicator: true,
torchButton: true,
exitButton: true,
debug_mode: true,
documentModalMessage: "Please ensure a document is visible in the frame",
blurModalMessage: "Image is too blurry, please try again",
submitButtonText: "Process Document",
retakeButtonText: "Capture Again"
});
Dynamic Configuration
You can update configuration during runtime:
info
All settings except lensFlavor
and container
can be updated during runtime.
VeryfiLens.configureLens({
blurModal: false,
torchButton: false
});