# Barcode Scan

{% hint style="info" %}

<pre data-overflow="wrap"><code>You'll need to import the javascript file in your website before starting from this <a data-footnote-ref href="#user-content-fn-1">link</a>.
</code></pre>

{% endhint %}

{% tabs %}
{% tab title="Plain Javascript" %}

```
const { Format, BarcodeScan } = WTN.Barcode;
BarcodeScan({
  format: Format.QR_CODE, // optional
  onBarcodeSearch: (value) => {
    console.log(value);
  },
});
```

{% endtab %}

{% tab title="ES5+" %}

```
import { Format, BarcodeScan } from "webtonative/barcode"
BarcodeScan({
  format: Format.QR_CODE, // optional
  onBarcodeSearch: (value) => {
    console.log(value);
  },
});
```

{% endtab %}
{% endtabs %}

**BarcodeScan**: Call BarcodeScan to scan barcode from native apps.

* **format**: This is optional parameter is you don't pass it, it will try to scan all the available barcode formats listed below.
* **onBarcodeSearch**: This callback function will be called when it successfully scans barcode.

## Format Types

Following is the list of all the supported format types

1. Format.ALL\_FORMATS
2. Format.QR\_CODE
3. Format.UNKNOWN
4. Format.CODE\_128
5. Format.CODE\_39
6. Format.CODE\_93
7. Format.CODABAR
8. Format.EAN\_13
9. Format.EAN\_8
10. Format.ITF
11. Format.UPC\_A
12. Format.PDF417
13. Format.AZTEC

[^1]: <https://docs.webtonative.com/javascript-apis/getting-started>
