Scanner APIAPIs
The Scanner API enables an extension to access scanner data and available scanning sources supported by the device.
Supporting targets
Anchor to scannerapiScannerApi
Creates a subscription to scan events Provides an initial value and a callback to subscribe to value changes. Currently supports only one subscription. You can utilize on a
to implement multiple subscriptions. Using
or the corresponding hooks counts as a subscription.
Creates a subscription to the scanning sources available on the POS device. Provides an initial value and a callback to subscribe to value changes. Currently supports only one subscription. You can utilize on a
to implement multiple subscriptions. Using
or the corresponding hooks counts as a subscription.
Anchor to examplesExamples
Examples of receiving updates from the Scanner API
Anchor to example-subscribe-to-scan-event-updatesSubscribe to scan event updates
Anchor to example-receiving-updates-on-available-scanner-sourcesReceiving updates on available scanner sources
Subscribe to scan event updates
Anchor to example-use-casesUse cases
Anchor to example-hardware-scanner-exampleHardware scanner example
In this example, assuming a physical scanner is connected to the POS, any scans performed when ui extensions are in use will automatically add the product to the cart if the data exists on the shop.
Anchor to example-conditional-scanner-source-rendering-exampleConditional scanner source rendering example
There might be situations where a developer needs to conditionally render UI elements based on the available scanning sources of the device on which the extension is installed. For example, an extension could be designed for full-screen camera scanning, but a device like POS GO does not have a camera. In such cases, it would be necessary to avoid rendering the camera scanner component and instead create a UI that supports embedded scanning.