Overview
Receipt scanning on mobile devices:- Camera Capture: Direct camera access for instant receipt photos
- SmartScan OCR: Automatic data extraction from receipt images
- Multi-Receipt Support: Scan multiple receipts in succession
- Gallery Import: Import existing photos from device
- Quality Detection: Automatic blur and quality checking
SmartScan automatically extracts merchant name, date, amount, and currency from receipt images.
Camera Permissions
iOS Camera Access
The app requests camera permissions on first use:src/components/AttachmentPicker/launchCamera/launchCamera.ios.ts
Android Camera Access
Android uses runtime permission requests:src/components/AttachmentPicker/launchCamera/launchCamera.android.ts
Permission Handling
When permissions are denied:src/libs/fileDownload/FileUtils.ts
Receipt Capture Flow
Taking a Receipt Photo
Receipt Processing
- Capture: User takes photo or selects from gallery
- Validation: App validates file format and size
- Upload: Receipt uploaded to server
- SmartScan: Server performs OCR extraction
- Review: User reviews and confirms extracted data
SmartScan OCR
Automatic Data Extraction
SmartScan extracts key information:- Merchant Name: Business name from receipt
- Date: Transaction date
- Amount: Total amount paid
- Currency: Detected currency
- Category: Suggested expense category
- Tax: Tax amount when visible
Receipt Data Structure
Scan States
1
SCANREADY
Receipt uploaded, queued for processing
2
SCANNING
SmartScan is actively processing the receipt
3
SCANNED
Data extraction complete, ready for review
4
OPEN
User manually entered or edited data
Handling Scan Results
Receipt Scanning Logic
Image Optimization
File Validation
src/libs/ReceiptUtils.ts
Image Formats
Supported receipt formats:- Images: JPEG, PNG, GIF, HEIC, WebP
- Documents: PDF
- Max Size: 25 MB per file
HEIC images (iPhone default) are automatically converted to JPEG for compatibility.
Thumbnail Generation
Server automatically generates optimized thumbnails:- 320px: List view thumbnails
- 1024px: Detail view
- Original: Full-resolution download
Multi-Receipt Scanning
Batch Upload
Scan multiple receipts in quick succession:Draft Management
Receipt Sources
Camera Capture
Gallery Import
Remote Receipt
After upload, receipt has remote source:Fallback Construction
When source is missing but filename exists:src/libs/ReceiptUtils.ts
Error Handling
Common Issues
Camera permission denied
Camera permission denied
Show alert guiding user to Settings:
Image too large
Image too large
Unsupported format
Unsupported format
SmartScan failed
SmartScan failed
Retry Logic
Offline Behavior
Receipt scanning works offline:- Capture: Receipt photo saved locally
- Queue: Upload queued for when online
- Display: Local image shown immediately
- Sync: Automatic upload when connection restored
- SmartScan: Processes once uploaded
Testing Receipt Scanning
Test Receipts
Use test receipts for development:Mock SmartScan
Best Practices
1
Good Lighting
Ensure receipts are well-lit for better OCR accuracy
2
Full Receipt Visible
Capture entire receipt including merchant name and total
3
Avoid Shadows
Position camera to minimize shadows and glare
4
Flat Surface
Lay receipt flat for optimal scanning
5
Review Extracted Data
Always verify SmartScan results before submitting
Next Steps
iOS Setup
Configure iOS camera permissions
Android Setup
Configure Android camera permissions
Offline Mode
Offline receipt handling
Create Expenses
Learn about expense management
