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- 'anydocs': AnyDocs- 'caps': Bottle cap code capture- 'code_strips': Printed code strip capture |
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 |
|---|---|---|---|
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 — prevents submission when no document detected (removes the "Submit Anyway" option from the modal) |
enforceBlurDetection | boolean | false | Forces blur detection validation — prevents submission when image is blurry (removes the "Submit Anyway" option from the modal) |
autoDocumentCapture | boolean | false | Enables automatic document capture when quality criteria are met (no manual capture button needed). Works with document and anydocs flavors |
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 |
isBlurModal | boolean | true | Shows warning modal when blur is detected |
isDocumentModal | boolean | true | Shows warning modal when no document is detected |
enableSubmit | boolean | true | Shows submit button after successful capture |
capCircleRadius | number | 0.7 | Default circle radius for bottle cap overlay |
rectWidth | number | 0.7 | Default width for code strip overlay |
rectHeight | number | 0.08 | Default height for code strip overlay |
Detection Thresholds
| Option | Type | Default | Description |
|---|---|---|---|
blurThreshold | number | 0.7 | Variance threshold for blur detection. Images with variance at or below this threshold are considered not blurry. Lower values make blur detection stricter |
lcdThreshold | number | 0.3 | Probability threshold for LCD detection (0-1). Values above the threshold are flagged as LCD screen captures |
LCD Detection (Fraud Prevention)
| Option | Type | Default | Description |
|---|---|---|---|
lcdDetectionForDocuments | boolean | false | Enables LCD screen detection for receipts, invoices, and other document types |
lcdDetectionForChecks | boolean | false | Enables LCD screen detection for check scanning |
lcdDetectionForCards | boolean | false | Enables LCD screen detection for credit card scanning |
isLcdModal | boolean | true | Shows warning modal when an LCD screen is detected |
enforceLcdDetection | boolean | false | Forces LCD detection validation — prevents submission when LCD is detected (removes the "Submit Anyway" option from the modal) |
Front/Back Detection (Check Side Classification)
| Option | Type | Default | Description |
|---|---|---|---|
frontBackDetectionForChecks | boolean | false | Enables front/back side classification for checks. Detects if the user captured the wrong side and shows a warning modal to retake (requires lensFlavor: 'checks') |
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') |
customSubmitHandler | function | null | Custom function that overrides the default submission flow. When set, called with the captured image instead of submitting to the Veryfi API |
customData | object | {} | Custom key-value data object included in document submissions. Must be a plain object (not an array or null) |
Fingerprint Settings
| Option | Type | Default | Description |
|---|---|---|---|
enforceFingerprint | boolean | false | Requires device fingerprint generation to succeed. Throws an error if fingerprint generation fails |
disableFingerprint | boolean | false | Disables device fingerprint generation entirely. Sets UUID to 'not_generated' and removes stored fingerprint from localStorage |
Check Processing
| Option | Type | Default | Description |
|---|---|---|---|
checksEnableManualMode | boolean | true | Enable/disable manual capture mode for checks when aspect ratio falls outside acceptable limits (requires lensFlavor: 'checks') |
checksManualModeTimeout | number | 3000 | Timeout in milliseconds before switching to manual mode (requires lensFlavor: 'checks') |
checksMaxAspectRatio | number | 2.61 | Maximum acceptable aspect ratio for check detection (requires lensFlavor: 'checks') |
checksMinAspectRatio | number | 2.61 | Minimum acceptable aspect ratio for check detection (requires lensFlavor: 'checks') |
persistManualModeOnRetake | boolean | true | Persist manual mode when retaking front side or capturing back side (requires lensFlavor: 'checks') |
forceLandscapeCheckPreview | boolean | false | Force horizontal/landscape orientation for check previews (requires lensFlavor: 'checks') |
Crop Settings
| Option | Type | Default | Description |
|---|---|---|---|
cropMargin | number | 0.0 | Margin around greenbox during cropping for all document types as percentage (0.0-1.0) |
checksCropMargin | number | 0.1 | Margin around greenbox during cropping for checks as percentage (0.0-1.0, requires lensFlavor: 'checks') |
cropLayoutAspectRatio | number | undefined | Custom aspect ratio for the manual mode crop layout guide overlay |
Crop Layout Overlay
| Option | Type | Default | Description |
|---|---|---|---|
cropLayoutBorderColor | string | "#54C08B" | Border color of the manual mode guide rectangle |
cropLayoutStroke | number | 2 | Border width in pixels of the manual mode guide rectangle |
cropLayoutOverlayAlpha | number | 0.6 | Transparency of the manual mode guide overlay (0-1) |
cropLayoutCornerRadius | number | 0 | Corner radius in pixels of the manual mode guide rectangle |
Checks Manual Mode Crop Layout Position & Size
| Option | Type | Default | Description |
|---|---|---|---|
cropLayoutGuideTopPosition | string | "40%" | Vertical position of the crop guide (CSS value, e.g., "40%", "200px") |
cropLayoutGuideLeftPosition | string | "50%" | Horizontal position of the crop guide (CSS value, e.g., "50%", "100px") |
cropLayoutGuideWidthScale | number | 0.90 | Width scale of guide relative to video width (0-1, where 0.90 = 90%) |
cropLayoutGuideMaxHeightScale | number | 0.70 | Maximum height scale of guide relative to video height (0-1, where 0.70 = 70%) |
Checks Manual Mode Crop Layout Tip Text Styling
| Option | Type | Default | Description |
|---|---|---|---|
cropLayoutTipPosition | string | "right" | Position of tip text relative to guide. Options: "top", "bottom", "left", "right" |
cropLayoutTipFontFamily | string | "Arial, sans-serif" | Font family for tip text |
cropLayoutTipFontSize | string | "16px" | Font size for tip text (CSS value, e.g., "16px", "1rem") |
cropLayoutTipFontWeight | string | "bold" | Font weight for tip text |
cropLayoutTipColor | string | "white" | Color for tip text |
cropLayoutTipTextShadow | string | "0 1px 2px rgba(0,0,0,0.8)" | Text shadow for tip text (CSS text-shadow value) |
cropLayoutTipOffset | string | "35%" | Offset distance of tip text from guide edge (CSS value) |
AnyDocs
| Option | Type | Default | Description |
|---|---|---|---|
anydocMaxPages | number | null | Maximum number of pages allowed. null means unlimited (requires lensFlavor: 'anydocs') |
anydocAddPageText | string | 'Add Page' | Custom text for the add page button (requires lensFlavor: 'anydocs') |
anydocSubmitText | string | 'Submit' | Custom text for the submit button (requires lensFlavor: 'anydocs') |
anydocShowFlipMessage | boolean | false | Shows a flip message after capturing a page (requires lensFlavor: 'anydocs') |
anydocFlipMessageText | string | 'Please flip the document and capture the other side' | Custom message for the flip prompt (requires lensFlavor: 'anydocs' and anydocShowFlipMessage: true) |
anydocFlipContinueText | string | 'Continue' | Custom text for the continue button in the flip prompt (requires lensFlavor: 'anydocs' and anydocShowFlipMessage: true) |
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') |
lcdModalMessage | string | 'LCD screen detected. Please capture a printed document instead' | Custom message for LCD detection modal |
wrongSideFrontMessage | string | 'This looks like the back of the check. Please flip and capture the front side.' | Custom message shown when back side is detected during front capture (requires frontBackDetectionForChecks: true) |
wrongSideBackMessage | string | 'This looks like the front of the check. Please flip and capture the back side.' | Custom message shown when front side is detected during back capture (requires frontBackDetectionForChecks: true) |
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') |
bottleCapText | string | 'Position bottle cap in circle' | Default instruction text for bottle cap overlay |
codeStripsText | string | 'Position code strip in rectangle' | Default instruction text for code strip overlay |
cropLayoutTipMessage | string | 'Position check inside rectangle' | Instructional text shown with the crop layout overlay in manual mode |
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 Examples
Document Scanning
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
torchButton: true,
exitButton: true,
isBlurModal: true,
isDocumentModal: 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"
});
Check Scanning with Manual Mode
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "checks",
captureBackOfCheck: true,
enforceBothSides: true,
checksEnableManualMode: true,
checksManualModeTimeout: 3000,
checksMaxAspectRatio: 2.7,
checksMinAspectRatio: 1.8,
checksCropMargin: 0.1,
persistManualModeOnRetake: true,
forceLandscapeCheckPreview: false,
// Checks manual mode crop layout overlay styling
cropLayoutBorderColor: "#54C08B",
cropLayoutStroke: 2,
cropLayoutOverlayAlpha: 0.6,
cropLayoutCornerRadius: 0,
// Checks manual mode crop layout positioning
cropLayoutGuideTopPosition: "40%",
cropLayoutGuideLeftPosition: "50%",
cropLayoutGuideWidthScale: 0.90,
cropLayoutGuideMaxHeightScale: 0.70,
// Checks manual mode crop layout tip text
cropLayoutTipMessage: "Align check within the guide",
cropLayoutTipPosition: "bottom",
cropLayoutTipFontSize: "18px",
cropLayoutTipColor: "white",
torchButton: true,
exitButton: true
});
Document Scanning with LCD Detection
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
torchButton: true,
exitButton: true,
lcdDetectionForDocuments: true,
isLcdModal: true,
enforceLcdDetection: false,
lcdThreshold: 0.4,
lcdModalMessage: "LCD screen detected. Please capture a printed document instead"
});
Check Scanning with LCD Detection
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "checks",
captureBackOfCheck: true,
enforceBothSides: true,
torchButton: true,
exitButton: true,
lcdDetectionForChecks: true,
isLcdModal: true,
enforceLcdDetection: true,
lcdThreshold: 0.4
});
Check Scanning with Front/Back Detection
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "checks",
captureBackOfCheck: true,
enforceBothSides: true,
torchButton: true,
exitButton: true,
frontBackDetectionForChecks: true,
wrongSideFrontMessage: "This looks like the back of the check. Please flip and capture the front side.",
wrongSideBackMessage: "This looks like the front of the check. Please flip and capture the back side."
});
AnyDocs
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "anydocs",
torchButton: true,
exitButton: true,
isBlurModal: true,
isDocumentModal: true,
anydocMaxPages: 10,
anydocAddPageText: "Add Page",
anydocSubmitText: "Submit All",
anydocShowFlipMessage: true,
anydocFlipMessageText: "Please flip the document and capture the other side",
anydocFlipContinueText: "Continue"
});
Automatic Document Capture
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
autoDocumentCapture: true,
torchButton: true,
exitButton: true,
isBlurModal: true,
isDocumentModal: true
});
Custom Submit Handler
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
torchButton: true,
exitButton: true,
customSubmitHandler: (image) => {
console.log("Custom handler received image:", image);
// Process image with your own API instead of Veryfi's
}
});
Custom Data with Submission
await VeryfiLens.init("YOUR_CLIENT_ID", {
lensFlavor: "document",
torchButton: true,
exitButton: true,
customData: {
userId: "user-123",
department: "accounting",
projectCode: "PRJ-456"
}
});
Dynamic Configuration
You can update configuration during runtime:
info
All settings except lensFlavor and container can be updated during runtime.
VeryfiLens.configureLens({
isBlurModal: false,
torchButton: false
});