Local Field Extraction
Local field extraction
Local field extraction runs on-device models during the submit preview so users can confirm that key receipt fields (such as vendor, date, and total) appear on the scan before upload. Configure which fields to look for with documentFieldsToDetect, and optionally block submission when fields are missing using allowSubmittingDocumentWithoutFields.
This capability is only available in dedicated SDK flavors for each platform:
| Platform | Package / dependency |
|---|---|
| iOS (SPM) | https://repo.veryfi.com/shared/lens/veryfi-lens-spm-field-detection.git |
| Android (Maven) | com.veryfi.lens:veryfi-lens-field-detection-sdk |
Use the same Veryfi repository credentials as for the standard Lens SPM or Maven packages. See
and Authentication.Supported field identifiers
| Id | Description |
|---|---|
vendor | Merchant / store name |
date | Transaction date |
total | Document total |
Matching is case-insensitive. Leave documentFieldsToDetect empty to disable the feature (standard Lens submit UI).
A typical configuration sets documentFieldsToDetect to ["vendor", "date", "total"].
Install the field-detection flavor
- iOS
- Android
Swift Package Manager
- In Xcode, choose File → Add Package Dependencies…
- Enter the package URL:
https://repo.veryfi.com/shared/lens/veryfi-lens-spm-field-detection.git
- Authenticate with your Veryfi Lens repository username and password (same credentials as other Lens SPM packages).
- Add the package to the app targets that call Lens.
Resolve credentials from the terminal (replace COCOAPODS_USERNAME and COCOAPODS_PASSWORD):
git credential approve <<EOF
protocol=https
host=repo.veryfi.com
path=shared/lens/veryfi-lens-spm-field-detection.git
username=COCOAPODS_USERNAME
password=COCOAPODS_PASSWORD
EOF
Add the Veryfi Maven repository to settings.gradle (same as the standard Lens setup), then add the field-detection artifact in build.gradle:
- Groovy
- Kotlin
dependencies {
implementation 'com.veryfi.lens:veryfi-lens-field-detection-sdk:VERSION'
}
dependencies {
implementation("com.veryfi.lens:veryfi-lens-field-detection-sdk:VERSION")
}
Replace VERSION with the latest release from Release notes.
Configure settings
Set documentFieldsToDetect and related UI colors on your Lens settings object before calling configure. When allowSubmittingDocumentWithoutFields is false, Lens shows an alert and blocks submit if any requested field is still missing after on-device detection.
- iOS
- Android
import VeryfiLens
let settings = VeryfiLensSettings()
settings.documentFieldsToDetect = ["vendor", "date", "total"]
settings.allowSubmittingDocumentWithoutFields = false
settings.documentFieldsUICornerRadius = 20
settings.documentFieldsBackgroundColor = "#04581a"
settings.documentFieldsTextColor = "#ffffff"
VeryfiLens.shared().configure(
with: credentials,
settings: settings,
completion: { success in
// Open camera when success == true
}
)
val settings = VeryfiLensSettings()
settings.documentFieldsToDetect = listOf("vendor", "date", "total")
settings.allowSubmittingDocumentWithoutFields = false
settings.documentFieldsUICornerRadius = 20.0
settings.documentFieldsBackgroundColor = "#04581a"
settings.documentFieldsTextColor = "#ffffff"
VeryfiLens.configure(context, credentials, settings) { success ->
// Open camera when success == true
}