Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.
Scanner API
The Scanner API provides access to barcode and QR code scanning functionality on POS devices, allowing you to subscribe to scan events, monitor available scanner sources, and process scanned data through subscription callbacks. The API enables integration with device cameras, external scanners, and embedded scanning hardware.
Anchor to Use casesUse cases
- Barcode scanning: Implement barcode scanning for product lookup or inventory management.
- QR scanning: Build QR code scanning features for customer engagement or loyalty programs.
- Custom workflows: Create custom scanning workflows that process scan data.
- Real-time feedback: Implement real-time scanning feedback with immediate processing.
Supported targets
Supported targets
Anchor to PropertiesProperties
The Scanner API object provides access to barcode and QR code scanning functionality on POS devices. Access the following properties on the API object to subscribe to scan events, monitor available scanner sources, and process scanned data.
- Anchor to scannerDataSubscribablescannerDataSubscribablescannerDataSubscribableRemoteSubscribable<ScannerSubscriptionResult>RemoteSubscribable<ScannerSubscriptionResult>requiredrequired
Subscribe to scan events to receive barcode and QR code data when scanned. Supports one subscription at a time. Use for receiving real-time scan results.
- Anchor to scannerSourcesSubscribablescannerSourcesSubscribablescannerSourcesSubscribableRemoteSubscribable<ScannerSource[]>RemoteSubscribable<ScannerSource[]>requiredrequired
Subscribe to changes in available scanner sources on the device. Supports one subscription at a time. Use to monitor which scanners are available (camera, external, or embedded).
ScannerSubscriptionResult
Represents the data from a scanner event. Contains the scanned string data and the hardware source that captured the scan.
- data
The string data from the last scanner event received. Contains the scanned barcode, QR code, or other scannable data. Returns `undefined` when no scan data is available. Use to process scanned content and implement scan-based business logic.
string - source
The scanning source from which the scan event came. Returns one of the following scanner types: • `'camera'` - Device camera for scanning through the camera interface (available on most mobile POS devices) • `'external'` - External scanner hardware connected using USB, Bluetooth, or other methods (handheld scanners, dedicated devices) • `'embedded'` - Built-in scanning hardware integrated into the POS device (specialized terminals with integrated scanning) Returns `undefined` when no scan source is available. Use to implement source-specific logic or provide feedback about scanning method.
ScannerSource
ScannerSource
The scanner source the POS device supports.
'camera' | 'external' | 'embedded'Anchor to Best practicesBest practices
- Validate scanned data appropriately: Validate scanned data before processing, implementing proper error handling for invalid codes, unsupported formats, or scanning errors.
- Provide clear scanning feedback: Give users clear feedback about scan results, including success confirmations, error messages, and guidance when scans fail or produce invalid data.
- Adapt to available scanner sources: Check available scanner sources and adapt your interface accordingly.
Anchor to LimitationsLimitations
- The Scanner API is only available in action (modal) targets where scanning functionality is supported and can't be used in other targets.
RemoteSubscribablesupports only one subscription at a time. UsemakeStatefulSubscribableif you need multiple components to subscribe to scan events simultaneously.- Scanning availability depends on device hardware capabilities and may vary between different POS devices and configurations.