# Barcode / QR Scanner

> Scan barcodes and QR codes with the device camera.

## Overview

The **Barcode / QR Scanner** feature allows your app users to scan **QR codes** and **barcodes** directly from your mobile app using their device's camera.

Depending on your configuration, the scanned data can:

* Open the scanned URL automatically
* Redirect users to a custom Action URL
* Pass the scanned value to your website using a JavaScript callback

This feature is available as a **Premium** add-on.

***

## Before You Begin

Before configuring the Barcode / QR Scanner, ensure the following requirements are met:

* Your app is on the **Premium Plan**.
* The **Barcode / QR Scanner** add-on is enabled.
* **Camera Permission** is enabled under **Branding → App Permissions**.

***

## Enable Barcode / QR Scanner

![](https://help.twinr.dev/assets/Screenshot%202026-07-09%20at%205.19.09%E2%80%AFPM.png)

1. Go to **Integrations → Native Features → Barcode / QR Scanner**.
2. Enable the **Barcode / QR Scanner** toggle.
3. Save your changes.
4. Publish your app.

Once enabled, the scanner can be assigned to supported buttons in your app.

***

## Add Scanner to a Navigation Bar Button

![](https://help.twinr.dev/assets/Screenshot%202026-07-09%20at%205.21.53%E2%80%AFPM.png)

You can launch the scanner directly from the app's Navigation Bar.

1. Go to **Screens**.
2. Open the desired screen.
3. Navigate to **Navigation Bar**.
4. Add a new button or edit an existing button.
5. Select **Barcode / QR Scanner** (Premium).

A configuration dialog will appear.

***

## Scanner Configuration

![](https://help.twinr.dev/assets/Screenshot%202026-07-09%20at%205.42.14%E2%80%AFPM.png)

### Button Icon

Choose the icon that will appear in the navigation bar.

### Code Type

Choose which type of code your scanner should detect.

#### QR Code

Scans QR Codes only.

When **QR Code** is selected, the following **Process Scan Data** options are available:

* Open Scanned URL
* Action URL
* JavaScript Callback

***

#### Barcode

Scans supported barcode formats (such as Code 128, EAN-13, UPC, etc.).

When **Barcode** is selected, the available options are:

* Action URL
* JavaScript Callback

> **Note:** **Open Scanned URL** is available only when **QR Code** is selected.

***

## Process Scan Data

Choose what should happen after a successful scan.

***

### Open Scanned URL

If the scanned QR Code contains a valid web URL, Twinr automatically opens that URL inside your app.

Example:

Scanned QR Code:

```
https://example.com/product/123
```

Result:

The user is redirected to:

```
https://example.com/product/123
```

***

### Action URL

Use this option when you want to send the scanned value to a custom URL.

After selecting **Action URL**, an additional field appears:

#### Action URL

Enter the destination URL.

The URL **must include** the placeholder:

```
{{code}}
```

Example:

```
https://example.com/verify/{{code}}
```

If the scanned code is:

```
ABC123456
```

Twinr will open:

```
https://example.com/verify/ABC123456
```

> **Important:** The `{{code}}` placeholder is mandatory. Twinr replaces it with the scanned barcode or QR code value at runtime.

***

### JavaScript Callback

Choose this option if you want your website to handle the scanned data.

After selecting **JavaScript Callback**, enter the name of the JavaScript function available on your website.

Example:

```
onBarcodeScanned
```

Your website should define the function:

```
function onBarcodeScanned(result) {    console.log(result);}
```

Whenever a barcode or QR code is scanned, Twinr calls this function and passes the scanned data.

This option is useful if you want to:

* Validate product codes
* Search products
* Trigger custom workflows
* Navigate users based on the scanned result

***

## Where Can I Use Barcode / QR Scanner?

Currently, the Barcode / QR Scanner can be launched from:

* Navigation Bar Buttons

Support for additional UI elements may be introduced in future releases.

***

## Important Notes

* Available only on the **Premium Plan**.
* Camera permission must be enabled.
* `{{code}}` is required when using **Action URL**.
* **Open Scanned URL** is supported only for **QR Code**.
* JavaScript Callback requires the specified function to exist on your website.

***

## FAQs

#### Why isn't the Barcode / QR Scanner working in my app?

Make sure:

* Barcode / QR Scanner is enabled.
* Camera permission is enabled.
* You are using the latest version of your mobile app.

***

#### What is the difference between QR Code and Others?

* **QR Code** scans only QR Codes and supports **Open Scanned URL**.
* **Others** scans supported barcode formats and supports **Action URL** and **JavaScript Callback**.

***

#### Is `{{code}}` required for Action URL?

Yes. Twinr replaces `{{code}}` with the scanned value. Without it, the scanned data cannot be passed to your destination URL.

***

#### Can I process the scanned data using JavaScript?

Yes. Select **JavaScript Callback** and enter the name of a JavaScript function available on your website. Twinr will invoke that function with the scanned result after a successful scan.

Source: https://help.twinr.dev/native-integrations/overview-1/barcode-qr-scanner
