Quick Start
- iOS
- Android
In this quick guide you will learn how to integrate the Veryfi Lens for Mobile iOS SDK into iOS apps for Receipts processing.
Prerequisites
- API credentials (more info: Authentication)
- Xcode project with CocoaPods or Swift Package Manager
- iOS 12.1 or later
- CocoaPods installed (if using CocoaPods method)
1. Obtaining Credentials
You need two sets of credentials:
- Access credentials to download the SDK (CocoaPods username and password)
- API credentials to access the Veryfi API (Client ID, API key, username, URL)
If you don't have an account with Veryfi, please register here: https://app.veryfi.com/signup/api/
In the Veryfi hub, go to https://app.veryfi.com/api/settings/keys/:
- In the
API Auth Credentials
section, you can get your API credentials - In the
Lens: Cocoapods (iOS)
section, click the "Add Access Key" button to create your access credentials- Fill in: First Name, Last Name, Email
- The system will generate your username and password automatically
- Save your generated username and password
2. iOS Installation
Option A: CocoaPods Installation
- Store Cocoapods Access Credentials with Git Credential Tool (Recommended):
git credential approve <<EOF
protocol=https
host=repo.veryfi.com
path=shared/lens/veryfi-lens-podspec.git
username=COCOAPODS_USERNAME
password=COCOAPODS_PASSWORD
EOF
- Update your Podfile:
- Extract version number from https://docs.veryfi.com/lens/mobile/settings/release_notes/
source 'https://repo.veryfi.com/shared/lens/veryfi-lens-podspec.git'
source 'https://github.com/CocoaPods/Specs.git'
target 'YourApp' do
use_frameworks!
pod 'VeryfiLens', '~> 2.2.33.4' # Replace with latest version
end
- Install the SDK:
pod repo update
pod install
- Open the workspace: Always use the
.xcworkspace
file, not the.xcodeproj
file
Option B: Swift Package Manager Installation
- Store SPM Access Credentials with Git Credential Tool:
git credential approve <<EOF
protocol=https
host=repo.veryfi.com
path=shared/lens/veryfi-lens-spm.git
username=COCOAPODS_USERNAME
password=COCOAPODS_PASSWORD
EOF
In Xcode: File → Add Package Dependencies
Enter package URL:
https://repo.veryfi.com/shared/lens/veryfi-lens-spm.git
Enter credentials: Use the same credentials created for CocoaPods (COCOAPODS_USERNAME and COCOAPODS_PASSWORD)
Select version:
- For latest version: Choose Dependency Rule
Branch
and set value tomaster
- For specific version:
- Extract version number from https://docs.veryfi.com/lens/mobile/settings/release_notes/
- If using Dependency Rule
Branch
: Use the full version number (e.g.,2.2.33.4
) - If using Dependency Rule
Exact Version
: Use SemVer format (e.g.,2.2.33
- remove the last number)
- For latest version: Choose Dependency Rule
Wait for Xcode to download the source and that's it, the package is installed
To resolve via terminal after adding the dependency in your project, store your credentials as follows:
git credential approve <<EOF
protocol=https
host=repo.veryfi.com
path=shared/lens/veryfi-lens-spm.git
username=COCOAPODS_USERNAME
password=COCOAPODS_PASSWORD
EOF
After adding the dependency in your project. Running xcodebuild -resolvePackageDependencies
will not fail in your pipeline
3. iOS Project Configuration
- Update Build Settings:
- Enable Bitcode: NO
- Validate Workspace: YES
If you're using Xcode 14 or above you may not need to update these settings, since these are now deprecated
- Add required permissions:
Option A: Using Info.plist file (if it exists):
<key>NSCameraUsageDescription</key>
<string>Scan documents</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Back up your document images in your photo gallery</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Choose document images to process from your photo gallery</string>
Option B: Using Xcode UI (if no Info.plist exists):
- Select your project in the navigator
- Select your target
- Go to the "Info" tab
- Add the following keys by clicking the "+" button:
Privacy - Camera Usage Description
(NSCameraUsageDescription) = "Scan documents"Privacy - Photo Library Additions Usage Description
(NSPhotoLibraryAddUsageDescription) = "Back up your document images in your photo gallery"Privacy - Photo Library Usage Description
(NSPhotoLibraryUsageDescription) = "Choose document images to process from your photo gallery"
4. iOS Initialization
- Import the SDK:
import VeryfiLens
- Configure your authentication credentials: Get your API credentials from https://app.veryfi.com/api/settings/keys/ → API Auth Credentials section:
let CLIENT_ID = "XXX" // replace XXX with your assigned Client Id
let AUTH_USERNAME = "XXX" // replace XXX with your assigned Username
let AUTH_APIKEY = "XXX" // replace XXX with your assigned API Key
let URL = "XXX" // replace XXX with your assigned Endpoint URL
let veryfiLensCredentials = VeryfiLensCredentials(clientId: CLIENT_ID,
username: AUTH_USERNAME,
apiKey: AUTH_APIKEY,
url: URL)
- Configure your Veryfi Lens settings for Receipts:
Option A: Using predefined Receipts settings (Recommended):
let veryfiLensSettings = VeryfiLensReceiptsSettings()
Option B: Using custom settings:
Use VeryfiLensSettings()
for complete custom configuration. Check available document types at https://docs.veryfi.com/lens/mobile/settings/#documenttypes:
let veryfiLensSettings = VeryfiLensSettings()
veryfiLensSettings.autoRotateIsOn = true
veryfiLensSettings.autoSubmitDocumentOnCapture = false
veryfiLensSettings.documentTypes = ["receipt"]
veryfiLensSettings.galleryIsOn = true
veryfiLensSettings.moreMenuIsOn = true
Available settings classes:
VeryfiLensSettings()
- Global settings class for complete custom configurationVeryfiLensReceiptsSettings()
- Predefined settings optimized for receipt processingVeryfiLensChecksSettings()
- Predefined settings optimized for check processing
- Implement the delegate:
extension ViewController: VeryfiLensDelegate {
func veryfiLensClose(_ json: [String : Any]) { /* handle */ }
func veryfiLensError(_ json: [String : Any]) { /* handle */ }
func veryfiLensSuccess(_ json: [String : Any]) { /* handle */ }
func veryfiLensUpdate(_ json: [String : Any]) { /* handle */ }
}
- Initialize the SDK:
VeryfiLens.shared().configure(with: veryfiLensCredentials,
settings: veryfiLensSettings) { success in
if success {
// SDK configured successfully
}
}
- Launch the camera:
VeryfiLens.shared().showCamera(in: self)
5. Full iOS Examples
UIKit Example: ViewController.swift
import UIKit
import VeryfiLens
class ViewController: UIViewController, VeryfiLensDelegate {
override func viewDidLoad() {
super.viewDidLoad()
setupVeryfiLens()
}
private func setupVeryfiLens() {
// Configure credentials
let CLIENT_ID = "CLIENT_ID"
let AUTH_USERNAME = "USERNAME"
let AUTH_APIKEY = "API_KEY"
let URL = "URL"
let veryfiLensCredentials = VeryfiLensCredentials(clientId: CLIENT_ID,
username: AUTH_USERNAME,
apiKey: AUTH_APIKEY,
url: URL)
// Configure settings
let veryfiLensSettings = VeryfiLensReceiptsSettings() // Predefined settings optimized for receipts
// Set delegate and configure
VeryfiLens.shared().delegate = self
VeryfiLens.shared().configure(with: veryfiLensCredentials,
settings: veryfiLensSettings) { success in
if success {
print("Veryfi Lens configured successfully")
}
}
}
@IBAction func openCamera(_ sender: Any) {
VeryfiLens.shared().showCamera(in: self)
}
// MARK: - VeryfiLensDelegate
func veryfiLensClose(_ json: [String : Any]) {
print("Lens closed: \(json)")
}
func veryfiLensError(_ json: [String : Any]) {
print("Lens error: \(json)")
}
func veryfiLensSuccess(_ json: [String : Any]) {
print("Lens success: \(json)")
// Process the extracted receipt data here
}
func veryfiLensUpdate(_ json: [String : Any]) {
print("Lens update: \(json)")
}
}
SwiftUI Example: ContentView.swift
import SwiftUI
import VeryfiLens
struct ContentView: View {
@StateObject private var lensManager = LensManager()
var body: some View {
VStack {
Button("Scan Receipt") {
lensManager.showCamera()
}
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(10)
}
.onAppear {
lensManager.setupVeryfiLens()
}
}
}
class LensManager: NSObject, ObservableObject, VeryfiLensDelegate {
func setupVeryfiLens() {
// Configure credentials
let CLIENT_ID = "CLIENT_ID"
let AUTH_USERNAME = "USERNAME"
let AUTH_APIKEY = "API_KEY"
let URL = "URL"
let veryfiLensCredentials = VeryfiLensCredentials(clientId: CLIENT_ID,
username: AUTH_USERNAME,
apiKey: AUTH_APIKEY,
url: URL)
// Configure settings
let veryfiLensSettings = VeryfiLensReceiptsSettings() // Predefined settings optimized for receipts
// Set delegate and configure
VeryfiLens.shared().delegate = self
VeryfiLens.shared().configure(with: veryfiLensCredentials,
settings: veryfiLensSettings) { success in
if success {
print("Veryfi Lens configured successfully")
}
}
}
func showCamera() {
// Get the current window scene
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first {
VeryfiLens.shared().showCamera(in: window.rootViewController!)
}
}
// MARK: - VeryfiLensDelegate
func veryfiLensClose(_ json: [String : Any]) {
print("Lens closed: \(json)")
}
func veryfiLensError(_ json: [String : Any]) {
print("Lens error: \(json)")
}
func veryfiLensSuccess(_ json: [String : Any]) {
print("Lens success: \(json)")
// Process the extracted receipt data here
}
func veryfiLensUpdate(_ json: [String : Any]) {
print("Lens update: \(json)")
}
}
In this quick guide you will learn how to integrate the Veryfi Lens for Mobile Android SDK into Android apps.
Prerequisites
- API and Maven credentials (more info: https://docs.veryfi.com/lens/mobile/introduction/authentication/)
- Kotlin or Java project with Gradle 8 and Java 17 minimum
- Minimum Android SDK 6.0 (API Level 23)
1. Obtaining credentials
You need two sets of credentials:
- Maven credentials to download the SDK (Maven username and password)
- Access credentials to access to the Veryfi API (Client ID, API key, username, URL)
If you don't have an account with Veryfi, please register here: https://app.veryfi.com/signup/api/
In the Veryfi hub, go to
Settings
>Keys
:- In the
API Auth Credentials
section, you can get your API credentials. - In the
Lens: Maven (Android)
section you can create your Maven credentials.
- In the
Add your Maven credentials to your system environment (e.g.,
~/.zshrc
). Replace[MAVEN_USERNAME]
and[MAVEN_PASSWORD]
with the credentials obtained in the previous step.export MAVEN_VERYFI_USERNAME=[USERNAME]
export MAVEN_VERYFI_PASSWORD=[PASSWORD]To check if the credentials are correct, run the next command in the terminal:
curl -sS --head https://$MAVEN_VERYFI_USERNAME:[email protected]/repository/maven-public/com/veryfi/lens/veryfi-lens-sdk/2.1.0.26/veryfi-lens-sdk-2.1.0.26.pom | grep "HTTP/2"
If prints
HTTP/2 200
, then the credentials are validbut if it is
HTTP/2 401
, the credentials are not valid. Please double check the environment variables, or create new credentials in the Veryfi hubKeys
page. To check the environment variables' values, run the next command to print them in the terminal:echo $MAVEN_VERYFI_USERNAME
echo $MAVEN_VERYFI_PASSWORD
2. Installation
To install the Veryfi Lens SDK for Android, you need to modify the next files:
- Add the Veryfi Maven repository at https://nexus.veryfi.com/repository/maven-releases/ to
settings.gradle
and use the environment variablesMAVEN_VERYFI_USERNAME
andMAVEN_VERYFI_PASSWORD
for authentication. - Add the
noCompress
property and theimplementation
dependency toapp/build.gradle
- Modify the
<application>
tag attributes inAndroidManifest.xml
- Add the Veryfi Maven repository at https://nexus.veryfi.com/repository/maven-releases/ to
Register the private Maven repository in the project-level
settings.gradle
orsettings.gradle.kts
:settings.gradle
(Groovy):
dependencyResolutionManagement {
repositories {
maven {
url "https://nexus.veryfi.com/repository/maven-releases/"
credentials {
username = System.getenv("MAVEN_VERYFI_USERNAME")
password = System.getenv("MAVEN_VERYFI_PASSWORD")
}
authentication {
basic(BasicAuthentication)
}
}
}
}
settings.gradle.kts
(Kotlin):
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven {
url = uri("https://nexus.veryfi.com/repository/maven-releases/")
credentials {
username = System.getenv("MAVEN_VERYFI_USERNAME")
password = System.getenv("MAVEN_VERYFI_PASSWORD")
}
authentication {
create<BasicAuthentication>("basic")
}
}
}
}
- In your
app/build.gradle
orapp/build.gradle.kts
file, add thenoCompress
property:
app/build.gradle
(Groovy):
android {
androidResources {
noCompress += 'veryfi'
}
}
app/build.gradle.kts
(Kotlin):
android {
androidResources {
noCompress += "veryfi"
}
}
Add the dependencies. Replace VERYFI_SDK_VERSION with the latest version (Versions and release notes: https://github.com/veryfi/veryfi-lens-receipts-android-demo/releases):
app/build.gradle
(Groovy):
dependencies {
implementation "com.veryfi.lens:veryfi-lens-sdk:VERYFI_SDK_VERSION"
}
app/build.gradle.kts
(Kotlin):
dependencies {
implementation("com.veryfi.lens:veryfi-lens-sdk:VERYFI_SDK_VERSION")
}
- If your
AndroidManifest.xml
hasandroid:allowBackup
tag, add the namespacetools
to the manifest, and include the following settings to the<application>
tag:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
tools:ignore="AllowBackup,GoogleAppIndexingWarning"
tools:replace="android:allowBackup">
</application>
</manifest>
- Finally, if you are using Android Studio, select
File
->Sync Project with Gradle Files
to download the depedencies and refresh the internal project model.
3. Initialization
- Import required classes from Lens SDK:
import com.veryfi.lens.VeryfiLens
import com.veryfi.lens.VeryfiLensDelegate
import com.veryfi.lens.helpers.DocumentType
import com.veryfi.lens.helpers.VeryfiLensCredentials
import com.veryfi.lens.helpers.VeryfiLensSettings
- Configure your authentication credentials. Replace
CLIENT_ID
,USERNAME
,API_KEY
andURL
with theAPI Auth Credentials
from the step 1:
val credentials = VeryfiLensCredentials().apply {
clientId = "CLIENT_ID"
username = "USERNAME"
apiKey = "API_KEY"
url = "URL"
}
- Configure your Veryfi Lens settings (Settings documentation: https://docs.veryfi.com/lens/mobile/settings/)
val settings = VeryfiLensSettings().apply {
autoRotateIsOn = true
autoSubmitDocumentOnCapture = true
documentTypes = arrayListOf(DocumentType.RECEIPT)
galleryIsOn = false
moreMenuIsOn = false
}
- Implement the
VeryfiLensDelegate
interface to handle the events triggered by Veryfi Lens:
class MyActivity : VeryfiLensDelegate {
override fun veryfiLensClose(json: JSONObject) { /* handle */ }
override fun veryfiLensError(json: JSONObject) { /* handle */ }
override fun veryfiLensSuccess(json: JSONObject) { /* handle */ }
override fun veryfiLensUpdate(json: JSONObject) { /* handle */ }
}
- Register the delegate:
VeryfiLens.setDelegate(this)
- Initialize the SDK with the credentials, settings and the
Application
instance:
VeryfiLens.configure(application, credentials, settings) { }
4. Starting the Lens (Camera) Flow
- Launch the Lens camera:
VeryfiLens.showCamera()
- Process the result in
VeryfiLensDelegate.veryfiLensSuccess(json)
.
5. Full Example: MyActivity.kt
class MyActivity : AppCompatActivity(), VeryfiLensDelegate {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val credentials = VeryfiLensCredentials().apply {
clientId = "CLIENT_ID"
username = "USERNAME"
apiKey = "API_KEY"
url = "URL"
}
val settings = VeryfiLensSettings().apply {
autoCaptureIsOn = true
autoRotateIsOn = true
documentTypes = arrayListOf(DocumentType.RECEIPT)
}
VeryfiLens.setDelegate(this)
VeryfiLens.configure(application, credentials, settings) { }
}
override fun veryfiLensClose(json: JSONObject) { Log.d("Lens", json.toString(2)) }
override fun veryfiLensError(json: JSONObject) { Log.d("Lens", json.toString(2)) }
override fun veryfiLensSuccess(json: JSONObject) { Log.d("Lens", json.toString(2)) }
override fun veryfiLensUpdate(json: JSONObject) { Log.d("Lens", json.toString(2)) }
private fun onSomeButtonClicked() {
VeryfiLens.showCamera()
}
}
Veryfi Lens Android SDK — One-Shot Integration Prompt (For AI Tools)
You can copy and paste this prompt into Cursor AI or Claude Code, or run it directly online using:
Run the prompt from @http://docs.veryfi.com/collections/one_shot_integration_prompt.md
You are an expert Android SDK assistant.
Integrate the Veryfi Lens for Mobile Android SDK into a Kotlin Android project with Gradle 8+, Java 17+, and minSdk 23.
Follow these exact steps and output all required code/config changes.
1. **Gradle Configuration**
- Update settings.gradle to add the Veryfi Maven repository with authentication.
Example (Groovy):
dependencyResolutionManagement {
repositories {
maven {
url "https://nexus.veryfi.com/repository/maven-releases/"
credentials {
username = System.getenv("MAVEN_VERYFI_USERNAME")
password = System.getenv("MAVEN_VERYFI_PASSWORD")
}
authentication {
basic(BasicAuthentication)
}
}
}
}
Example (Kotlin):
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven {
url = uri("https://nexus.veryfi.com/repository/maven-releases/")
credentials {
username = System.getenv("MAVEN_VERYFI_USERNAME")
password = System.getenv("MAVEN_VERYFI_PASSWORD")
}
authentication {
create<BasicAuthentication>("basic")
}
}
}
}
- Get the latest version number (without the "v" prefix) from https://github.com/veryfi/veryfi-lens-receipts-android-demo/releases/latest.
- Add to app/build.gradle and replace VERYFI_SDK_VERSION with the latest version number from the previous step:
android {
androidResources {
noCompress += "veryfi"
}
}
dependencies {
implementation("com.veryfi.lens:veryfi-lens-sdk:VERYFI_SDK_VERSION")
}
2. **AndroidManifest Changes**
- If android:allowBackup exist, add:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
tools:ignore="AllowBackup,GoogleAppIndexingWarning"
tools:replace="android:allowBackup">
</application>
</manifest>
3. **Kotlin Code**
- Import:
import com.veryfi.lens.VeryfiLens
import com.veryfi.lens.VeryfiLensDelegate
import com.veryfi.lens.helpers.DocumentType
import com.veryfi.lens.helpers.VeryfiLensCredentials
import com.veryfi.lens.helpers.VeryfiLensSettings
- Create credentials:
val credentials = VeryfiLensCredentials().apply {
clientId = "CLIENT_ID"
username = "USERNAME"
apiKey = "API_KEY"
url = "URL"
}
- Create settings:
val settings = VeryfiLensSettings().apply {
autoRotateIsOn = true
autoSubmitDocumentOnCapture = true
documentTypes = arrayListOf(DocumentType.RECEIPT)
galleryIsOn = false
moreMenuIsOn = false
}
- Implement VeryfiLensDelegate with:
veryfiLensClose(json: JSONObject), veryfiLensError(json: JSONObject), veryfiLensSuccess(json: JSONObject), veryfiLensUpdate(json: JSONObject)
- Register delegate:
VeryfiLens.setDelegate(this)
- Configure SDK:
VeryfiLens.configure(application, credentials, settings) { }
- Launch camera:
VeryfiLens.showCamera()