# Get started with the JS library

Getting started with development for the JS library has four main steps:

1. Check the prerequisites.
2. Include the JS library.
3. Pair with the integration server simulator.
4. Register your POS software.


For step 4, check the certification criteria for the specific requirements around the POS
Information fields and API key configuration:
[Certification Criteria Document](/assets/certification_criteria_iclient_retail_hospitality.7bf0b2b5462961db882fcba1f1e9ddbec0d942cc7ee96278907994599bebf62a.d564e73d.pdf).

## JS library API reference

For a sample HealthPoint claiming code: [JS library API reference](/assets/iclient-api.57e262928075df78cfa8a01bd63db2f4b79b8d58736bbb024a56daa62cd686fe.fbf1555a.zip).
After downloading the zip, unzip it and open the `iclient-api` folder, then `index`. Under APIs in
the top-left corner, click Classes, then `TYRO.IClientWithUI`, scroll down to the index and method
tabs, and click index.

## Checking for prerequisites

Before getting started, make sure the following prerequisites are met:

- Use a compatible browser for development. The JS library is only compatible with:
  - Google Chrome
  - Mozilla Firefox
  - Safari
  - Microsoft Internet Explorer
  - Microsoft Edge
- When using the integration server simulator, you'll also need your allocated Merchant ID (MID)
and Terminal ID (TID) combination to pair with it. Reach out to the POS Integration team via
[email](mailto:integrationsupport@tyro.com) and they'll provide the allocated pairing
credentials.


## Including the JS library

- Headful library



```javascript
<script type="text/javascript" src="{Base URL}/iclient-with-ui-v1.js"></script>
```

- Headless library



```javascript
<script type="text/javascript" src="{Base URL}/iclient-v1.js"></script>
```

During testing and development, set the base URL to https://iclientsimulator.test.tyro.com

The simulator uses pre-configured magic values to replicate specific scenarios in the transaction
lifecycle — see them [here](https://integrationsimulator.test.tyro.com/docs/).

Once certified and live, your POS integration uses https://iclient.tyro.com as the base URL.

## Pairing to the integration server simulator

Pairing uses a MID and TID combination, provided to you by the Tyro POS integration team. The
pairing request is initiated from an embedded pairing URL — this configuration page must be
embedded in an iframe in the POS — found
[here](https://iclientsimulator.test.tyro.com/configuration.html#expert). Once you start a
pairing request, it needs to be confirmed physically on the terminal, and the pairing page then
gets a response confirming the pairing.

![Configuration page](/assets/pairing.c0c09c0ec8540f935ffe1c9811ebc1203a301f0d57f5f7057939b8bd42c0fc61.68286485.png)

If the user clears local storage in the browser, the pairing details are deleted and the terminal
needs to be re-paired.

See [Pairing](/docs/in-person-payments/pay-in-person/integration-guide/js-library/pairing) for the full pairing mechanism, including the alternative headless
pairing API.

## Registering your POS software

When using the JS library, register your POS software using the `POSInformation` method, so the
correct and relevant information about your POS integration is returned to the Tyro servers in
integration requests. This helps Tyro identify integration requests and aids the support team in
resolving any issues that come up in production. The specification and example for the headful and
headless library are given below.

### Headful library

**Specification:**

`TYRO.IClientWithUI(apiKey, posProductData)`

**Parameters:**

- `apiKey` (String) — the API key provided by Tyro (not validated in test environments).
- `posProductData` — an object containing the following properties (final values to be confirmed
by Tyro):


| Parameter | Type | Description | Required |
|  --- | --- | --- | --- |
| `posProductVendor` | String | Name of your company. | Yes |
| `posProductName` | String | Name of your product. | Yes |
| `posProductVersion` | String | Version of your product. | Yes |


**Example:**


```javascript
var iclient = new TYRO.IClientWithUI("apiKey", {posProductVendor: "Awesome POS CO", 
posProductName: "AwesomePOS", posProductVersion: "1.0.1"});
```

### Headless library

**Specification:**

`TYRO.IClient(apiKey, posProductData)`

**Parameters:**

- `apiKey` (String) — the API key provided by Tyro (not validated in test environments).
- `posProductData` — an object containing the following properties (final values to be confirmed
by Tyro):


| Parameter | Type | Description | Required |
|  --- | --- | --- | --- |
| `posProductVendor` | String | Name of your company. | Yes |
| `posProductName` | String | Name of your product. | Yes |
| `posProductVersion` | String | Version of your product. | Yes |


All parameters are mandatory.

## Working example

A JS Fiddle example demonstrating the POS information being set in the method, then retrieved
from the iClient object and displayed when the "Show POS Information" button is clicked:

[JS Fiddle demo](https://jsfiddle.net/IntegrationSupport/v581uceo/)