> For the complete documentation index, see [llms.txt](https://docs.mod91.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mod91.io/mod91-webview-sdk/installation.md).

# Installation

Installation steps for the Mod91WebViewSDK.

{% hint style="info" %}
**It is a private npm package and will need an auth token to install it in your nodejs project.**
{% endhint %}

## Installation Steps

### Step 1

Get auth token and add to **.npmrc** file. It is commonly found in the root directory of your system.

```
//registry.npmjs.org/:_authToken=[AUTH_TOKEN]
```

Replace `[AUTH_TOKEN]` with the auth token given to you and save the file.

### Step 2

Run `npm install` inside your project to install the package:

```sh
npm i @satyajiit.mod91/mod91-webview-sdk
```

### Step 3

Importing the package

Example to access `PaymentsAPI`:&#x20;

```typescript
import * as mod91sdk from "@satyajiit.mod91/mod91-webview-sdk"

// Using async/await
const serialNumber = await mod91sdk.PaymentsAPI.getDeviceSerialNumber()

// Using then()
let serialNumber;
mod91sdk.PaymentsAPI.getDeviceSerialNumber().then((result) => {
    seserialNumber = result
})

// serialNumber will contain serial number of device.
```

All the following APIs can be accessed in the same manner.&#x20;

**`sdk.[API Name].[Method Name]`**

## Error Handling

All sdk methods are `Promises` . They all throw Promise rejection when an error has occured

```javascript
// Using async/await
try {
    const serialNumber = await mod91sdk.PaymentsAPI.getDeviceSerialNumber()
} catch(e) {
    console.log(e.message)
}

// Using then()
let serialNumber;
mod91sdk.PaymentsAPI.getDeviceSerialNumber().then((result) => {
    seserialNumber = result
}).catch((e) => {
    console.log(e.message)
})
```
