Native Plugins & Integrations1 min read
QR and Barcode Scanner
Scan QR codes and barcodes from your website with a native full-screen scanner: supported formats, scanner screen options, permissions and code examples.
Overview
The QR / Barcode Scanner plugin opens a native full-screen scanner and returns the result to your page. It is faster and more reliable than scanning in the browser.
Turn it on in Integrations › Native plugins and build a new version.
Scan
javascript
const result = await wapp.barcode.scan({
formats: ['QR_CODE', 'EAN_13'],
prompt: 'Scan your ticket',
});
if (result.success) {
console.log(result.type, result.code); // "QR_CODE", "https://..."
} else if (result.code === 'CANCELLED') {
// the user closed the scanner
} else if (result.code === 'PERMISSION_DENIED') {
// camera access was refused
}Formats: QR_CODE, DATA_MATRIX, AZTEC, PDF_417, EAN_13, EAN_8, UPC_A, UPC_E, CODE_39, CODE_93, CODE_128, ITF (ITF-14 only) and CODABAR. Leave formats out to scan all of them.
wapp.barcode.setPrompt('Point at the code') changes the text for the next scans. The Default prompt setting does the same without code.
Plugin settings
| Setting | What it does | New build? |
|---|---|---|
| Scanner screen | themed: full screen in your colors. system: the phone's own scanner | Yes |
| Camera permission text (iOS) | The camera purpose string | Yes |
| Default prompt | Text shown in the scanner | No |
| themed (default) | system | |
|---|---|---|
| Android | asks for camera permission | no camera permission needed |
| iPhone | asks for camera permission | asks for camera permission (iOS 16 and later) |
Tips
- Limit
formatsto what you expect: scanning is faster and avoids wrong matches. - Validate the scanned value on your server before acting on it.