📱Installation

Installation steps for the Mod91WebViewSDK.

It is a private npm package and will need an auth token to install it in your nodejs project.

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:

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

Step 3

Importing the package

Example to access PaymentsAPI:

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.

sdk.[API Name].[Method Name]

Error Handling

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

// 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)
})

Last updated

Copyright Mod91 2024