The Genius Scan SDK provides specialized receipt scanning capabilities that combine document capture with automatic data extraction. This feature extracts structured information from receipts, including merchant details, amounts, dates, and VAT information.
Enable receipt scanning by adding receipt extraction to your ScanFlow configuration:
let configuration = GSKScanFlowConfiguration()
// Enable receipt extraction
configuration.structuredData = [.receipt]
configuration.multiPage = false
configuration.skipPostProcessingScreen = true
// Start scan flow
let scanFlow = GSKScanFlow(configuration: configuration)
scanFlow.start(from: viewController, onSuccess: { result in
// Access receipt data
if let receipt = result.scans.first?.structuredDataResult?.receipt {
print("Merchant: \(receipt.merchant ?? "Unknown")")
print("Amount: \(receipt.amount ?? 0)")
print("Date: \(receipt.date ?? Date())")
print("Currency: \(receipt.currency ?? "")")
print("Category: \(receipt.category ?? "")")
print("VAT Number: \(receipt.vatNumber ?? "")")
}
}, failure: { error in
// Handle error
})
val configuration = ScanConfiguration().apply {
// Enable receipt extraction
structuredData = EnumSet.of(StructuredData.RECEIPT)
multiPage = false
}
// Start scan flow
ScanFlow.scanWithConfiguration(activity, configuration)
// Handle result
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
val result = ScanFlow.getScanResultFromActivityResult(data)
// Access receipt data
result.scans?.first()?.structuredDataResult?.receipt?.let { receipt ->
Log.d("Receipt", "Merchant: ${receipt.merchant}")
Log.d("Receipt", "Amount: ${receipt.amount}")
Log.d("Receipt", "Date: ${receipt.date}")
Log.d("Receipt", "Currency: ${receipt.currency}")
Log.d("Receipt", "Category: ${receipt.category}")
Log.d("Receipt", "VAT Number: ${receipt.vatNumber}")
}
}
const configuration = {
// Enable receipt extraction
structuredData: ['receipt'],
multiPage: false,
skipPostProcessingScreen: true
};
// Start scan flow
try {
const result = await RNGeniusScan.scanWithConfiguration(configuration);
// Access receipt data
if (result.scans?.[0]?.structuredData?.receipt) {
const receipt = result.scans[0].structuredData.receipt;
console.log("Merchant:", receipt.merchant);
console.log("Amount:", receipt.amount);
console.log("Date:", receipt.date);
console.log("Currency:", receipt.currency);
console.log("Category:", receipt.category);
console.log("VAT Number:", receipt.vatNumber);
}
} catch (error) {
// Handle error
console.error("Scan failed:", error);
}
var configuration = {
// Enable receipt extraction
'structuredData': ['receipt'],
'multiPage': false,
'skipPostProcessingScreen': true
};
// Start scan flow
try {
var result = await FlutterGeniusScan.scanWithConfiguration(configuration);
// Access receipt data
var receipt = result['scans']?[0]?['structuredData']?['receipt'];
if (receipt != null) {
print("Merchant: ${receipt['merchant']}");
print("Amount: ${receipt['amount']}");
print("Date: ${receipt['date']}");
print("Currency: ${receipt['currency']}");
print("Category: ${receipt['category']}");
print("VAT Number: ${receipt['vatNumber']}");
}
} catch (error) {
// Handle error
print("Scan failed: $error");
}
var configuration = {
// Enable receipt extraction
structuredData: ['receipt'],
multiPage: false,
skipPostProcessingScreen: true
};
// Start scan flow
cordova.plugins.GeniusScan.scanWithConfiguration(configuration,
function(result) {
// Access receipt data
var receipt = result.scans?.[0]?.structuredData?.receipt;
if (receipt) {
console.log("Merchant:", receipt.merchant);
console.log("Amount:", receipt.amount);
console.log("Date:", receipt.date);
console.log("Currency:", receipt.currency);
console.log("Category:", receipt.category);
console.log("VAT Number:", receipt.vatNumber);
}
},
function(error) {
// Handle error
console.error("Scan failed:", error);
}
);
var configuration = new ScanConfiguration
{
// Enable receipt extraction
StructuredData = new[] { StructuredDataType.Receipt },
MultiPage = false,
SkipPostProcessingScreen = true
};
// Start scan flow
try
{
var result = await GeniusScan.ScanWithConfigurationAsync(configuration);
// Access receipt data
var receipt = result.Scans?.FirstOrDefault()?.StructuredData?.Receipt;
if (receipt != null)
{
Console.WriteLine($"Merchant: {receipt.Merchant}");
Console.WriteLine($"Amount: {receipt.Amount}");
Console.WriteLine($"Date: {receipt.Date}");
Console.WriteLine($"Currency: {receipt.Currency}");
Console.WriteLine($"Category: {receipt.Category}");
Console.WriteLine($"VAT Number: {receipt.VatNumber}");
}
}
catch (Exception ex)
{
// Handle error
Console.WriteLine($"Scan failed: {ex.Message}");
}
The SDK extracts the following receipt information:
Field | Description | Type |
---|---|---|
Merchant | Store or vendor name | String |
Amount | Total receipt amount | Decimal |
Date | Transaction date | Date |
Currency | Currency code (USD, EUR, etc.) | String |
Locale | Receipt locale information | String |
Category | Receipt category classification | String |
VAT Number | Merchant’s VAT registration number | String |
VAT Values | VAT rates and amounts (can be multiple) | Array |
Receipts may contain multiple VAT rates that apply to different items. Each VAT entry includes:
Handle cases where extraction might fail:
if let receipt = result.scans.first?.structuredData?.receipt {
// Process receipt data
} else {
// No receipt data extracted
// You still have the scanned image
let imageUrl = result.scans.first?.enhancedFilePath
// Allow manual entry or retry
}
© 2025 The Grizzly Labs. All rights reserved.