Skip to main content

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:

PlatformPackage / 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
info

Use the same Veryfi repository credentials as for the standard Lens SPM or Maven packages. See

and Authentication.

Supported field identifiers

IdDescription
vendorMerchant / store name
dateTransaction date
totalDocument 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

Swift Package Manager

  1. In Xcode, choose File → Add Package Dependencies…
  2. Enter the package URL:
https://repo.veryfi.com/shared/lens/veryfi-lens-spm-field-detection.git
  1. Authenticate with your Veryfi Lens repository username and password (same credentials as other Lens SPM packages).
  2. 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

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.

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