Skip to main content

Configuration Options

The SDK accepts a configuration object during initialization with the following options:

Core Settings

OptionTypeDefaultDescription
lensFlavorstringRequiredDetermines 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
containerstringundefinedHTML element ID where lens will mount. Creates full-screen overlay if not specified
debug_modebooleanfalseEnables debug logging to console

Document Processing

OptionTypeDefaultDescription
detectScreenCapturebooleanfalseEnables detection of screen capture attempts
enforceBothSidesbooleanfalseEnforces capture of both sides of documents
enforceAndSkipBothSidesbooleanfalseEnforces both sides capture but skips the dialog
delayBetweenCapturesnumber0Delay in milliseconds between front and back capture
enforceDocumentDetectionbooleanfalseForces document detection validation
enforceBlurDetectionbooleanfalseForces blur detection validation

UI Elements

OptionTypeDefaultDescription
torchButtonbooleanfalseAdds flashlight toggle button (requires device support)
exitButtonbooleanfalseAdds button to close camera view
blurModalbooleanfalseShows warning when blur detected
isDocumentModalbooleanfalseShows warning when no document detected
enableSubmitbooleantrueShows submit button after successful capture
capCircleRadiusnumber0.7Default circle radius for bottle cap overlay
rectWidthnumber0.7Default width for code strip overlay
rectHeightnumber0.08Default height for code strip overlay

Special Features

OptionTypeDefaultDescription
captureBackOfCheckbooleanfalseEnables back side capture for checks (requires lensFlavor: 'checks')
enableLongReceiptPreviewbooleanfalseShows preview during receipt stitching (requires lensFlavor: 'long_document')

Check Processing

OptionTypeDefaultDescription
checksEnableManualModebooleantrueEnable/disable manual capture mode for checks when aspect ratio falls outside acceptable limits (requires lensFlavor: 'checks')
checksManualModeTimeoutnumber3000Timeout in milliseconds before switching to manual mode (requires lensFlavor: 'checks')
checksMaxAspectRationumber2.61Maximum acceptable aspect ratio for check detection (requires lensFlavor: 'checks')
checksMinAspectRationumber2.61Minimum acceptable aspect ratio for check detection (requires lensFlavor: 'checks')
persistManualModeOnRetakebooleantruePersist manual mode when retaking front side or capturing back side (requires lensFlavor: 'checks')
forceLandscapeCheckPreviewbooleanfalseForce horizontal/landscape orientation for check previews (requires lensFlavor: 'checks')

Crop Settings

OptionTypeDefaultDescription
cropMarginnumber0.0Margin around greenbox during cropping for all document types as percentage (0.0-1.0)
checksCropMarginnumber0.1Margin around greenbox during cropping for checks as percentage (0.0-1.0, requires lensFlavor: 'checks')
cropLayoutAspectRationumberundefinedCustom aspect ratio for the manual mode crop layout guide overlay

Crop Layout Overlay

OptionTypeDefaultDescription
cropLayoutBorderColorstring"#54C08B"Border color of the manual mode guide rectangle
cropLayoutStrokenumber2Border width in pixels of the manual mode guide rectangle
cropLayoutOverlayAlphanumber0.6Transparency of the manual mode guide overlay (0-1)
cropLayoutCornerRadiusnumber0Corner radius in pixels of the manual mode guide rectangle

Checks Manual Mode Crop Layout Position & Size

OptionTypeDefaultDescription
cropLayoutGuideTopPositionstring"40%"Vertical position of the crop guide (CSS value, e.g., "40%", "200px")
cropLayoutGuideLeftPositionstring"50%"Horizontal position of the crop guide (CSS value, e.g., "50%", "100px")
cropLayoutGuideWidthScalenumber0.90Width scale of guide relative to video width (0-1, where 0.90 = 90%)
cropLayoutGuideMaxHeightScalenumber0.70Maximum height scale of guide relative to video height (0-1, where 0.70 = 70%)

Checks Manual Mode Crop Layout Tip Text Styling

OptionTypeDefaultDescription
cropLayoutTipPositionstring"right"Position of tip text relative to guide. Options: "top", "bottom", "left", "right"
cropLayoutTipFontFamilystring"Arial, sans-serif"Font family for tip text
cropLayoutTipFontSizestring"16px"Font size for tip text (CSS value, e.g., "16px", "1rem")
cropLayoutTipFontWeightstring"bold"Font weight for tip text
cropLayoutTipColorstring"white"Color for tip text
cropLayoutTipTextShadowstring"0 1px 2px rgba(0,0,0,0.8)"Text shadow for tip text (CSS text-shadow value)
cropLayoutTipOffsetstring"35%"Offset distance of tip text from guide edge (CSS value)

Text Customization

OptionTypeDefaultDescription
documentModalMessagestring'Oops, There appears to be no document on your image'Custom message for document detection modal
blurModalMessagestring'Oops, The image is too blurry to process'Custom message for blur detection modal
submitButtonTextstring'Submit Anyway'Custom text for submit button
retakeButtonTextstring'Retake a picture'Custom text for retake button
cropButtonTextstring'Crop'Custom text for crop button
resetButtonTextstring'Reset'Custom text for reset button
dropZoneTextstring'Click or drag and drop to upload an image'Custom text for upload drop zone (requires lensFlavor: 'upload')
checkEnforcedModalMessagestring'Please flip the check and capture the back side'Custom message when back check capture is required (requires lensFlavor: 'checks' and enforceBothSides: true)
checkOptionalModalMessagestring'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)
checkContinueButtonTextstring'Continue'Custom text for check continue button (requires lensFlavor: 'checks' and enforceBothSides: true)
checkYesButtonTextstring'Yes'Custom text for check confirmation button (requires lensFlavor: 'checks')
checkNoButtonTextstring'No'Custom text for check rejection button (requires lensFlavor: 'checks')
bottleCapTextstring'Position bottle cap in circle'Default instruction text for bottle cap overlay
codeStripsTextstring'Position code strip in rectangle'Default instruction text for code strip overlay
cropLayoutTipMessagestringundefinedInstructional text shown with the crop layout overlay in manual mode
OptionTypeDefaultDescription
onCloseRedirectUrlstringundefinedURL to redirect to when exit pressed
onClosefunctionundefinedCallback when camera view closes:
(isVisible: boolean) => void

Usage Examples

Document Scanning

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"
});

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
});

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
});