> 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/api-reference/paymentsapi.md).

# PaymentsAPI

### 1. getDeviceSerialNumber

```
getDeviceSerialNumber(): Promise<string>
```

Returns serial number of device as type`string`.

### 2. getReceipt

```javascript
getReceipt(txnId: string): Promise<TransactionReceiptData>
```

Returns receipt data for the particular transaction ID.

***

Accepts `transactionId` as parameter.&#x20;

***

Returns `TransactionReceiptData`:

```
date: string;
approvalCode: string;
appVersion: string;
businessName: string;
retrievalReferenceNumber: string;
deviceId: number;
responseCode: string;
issuerCTI: string;
merchantTidVisibility: number;
'9F12': string;
merchantId: string;
'9F11': string;
appId: string;
appPerName: string;
timestampGMT: string;
fullCardType: string;
acquirerName: string;
batchNumber: string;
longitude: string;
ac: string;
receivingInstitutionCode: string;
transactionID: string;
firstName: string;
tvr: string;
custMaskedCardNumber: string;
tipOption: string;
tgTransactionID: string;
creditDebitCardType: string;
billNumber: string;
applicationId: string;
processingFeeMode: string;
cardNumber: string;
acquirerLogo: string;
statusCode: string;
cid: string;
latitude: string;
offlineCounter: string;
custTidVisibility: number;
terminalId: string;
tsi: string;
creditDebitCardTypeName: string;
result: string;
processingMerchantCode: string;
expiryDate: string;
refTransactionType: string;
appLabel: string;
invoiceNumber: string;
currency: string;
cashBackAmount: string;
tgName: string;
cashBack: string;
issuerBankName: string;
amount: string;
merchantMidVisibility: number;
cardHolderName: string;
address2: string;
tipAmount: string;
transactionStatus: string;
transactionMode: string;
address1: string;
cardType: string;
custMidVisibility: number;
'9F06': string;
message: string;
balanceAmount: string;
transactionType: number;
isPinVerified: boolean;
stan: string;
time: string;
isSignatureRequired: boolean;
orderId: string;
shipperId: string;
transType: string;
```

### 3. readCardNumber

```typescript
readCardNumber(commandCallback?: CommandCallbackFunction) : Promise<ReadCardNumberResult>
```

Gives card details currently inserted in the POS device.

***

Accepts `commandCallback : CommandCallbackFunction : (command: string) => void.` Callback function to be passed if commands are required which are generated by payment device.

Example :&#x20;

```typescript
mod91Sdk.PaymentsAPI.readCardNumber((command) => {
          console.log("COMMAND", command)
        });
```

***

Returns `ReadCardNumberResult` :&#x20;

```javascript
cardHash256: string;
cardHash: string;
cardHash512: string;
cardHash128: string;
cardBin: string;
result: boolean
```

### 4. voidTransaction

```typescript
voidTransaction(txnId: string ,commandCallback: CommandCallbackFunction): Promise<TransactionReceiptData>
```

Voids a transaction for the given transaction ID.

***

Accepts `transactionId` as parameter.&#x20;

Accepts `commandCallback : CommandCallbackFunction : (command: string) => void.` Callback function to be passed if commands are required which are generated by payment device.

***

Returns `TransactionReceiptData`:

```typescript
date: string;
approvalCode: string;
appVersion: string;
businessName: string;
retrievalReferenceNumber: string;
deviceId: number;
responseCode: string;
issuerCTI: string;
merchantTidVisibility: number;
'9F12': string;
merchantId: string;
'9F11': string;
appId: string;
appPerName: string;
timestampGMT: string;
fullCardType: string;
acquirerName: string;
batchNumber: string;
longitude: string;
ac: string;
receivingInstitutionCode: string;
transactionID: string;
firstName: string;
tvr: string;
custMaskedCardNumber: string;
tipOption: string;
tgTransactionID: string;
creditDebitCardType: string;
billNumber: string;
applicationId: string;
processingFeeMode: string;
cardNumber: string;
acquirerLogo: string;
statusCode: string;
cid: string;
latitude: string;
offlineCounter: string;
custTidVisibility: number;
terminalId: string;
tsi: string;
creditDebitCardTypeName: string;
result: string;
processingMerchantCode: string;
expiryDate: string;
refTransactionType: string;
appLabel: string;
invoiceNumber: string;
currency: string;
cashBackAmount: string;
tgName: string;
cashBack: string;
issuerBankName: string;
amount: string;
merchantMidVisibility: number;
cardHolderName: string;
address2: string;
tipAmount: string;
transactionStatus: string;
transactionMode: string;
address1: string;
cardType: string;
custMidVisibility: number;
'9F06': string;
message: string;
balanceAmount: string;
transactionType: number;
isPinVerified: boolean;
stan: string;
time: string;
isSignatureRequired: boolean;
orderId: string;
shipperId: string;
transType: string;
```

### 5. initiateTransaction

```typescript
 initiateTransaction(initiateTransactionInput: InitiateTransactionInput, commandCallback?: CommandCallbackFunction): Promise<TransactionReceiptData> {
```

Initiates transaction on device.

***

Accepts : `InitiateTransactionInput` :&#x20;

orderAmount : `string` : The amount for which to initiate the transaction.

description?: `string :` Transaction Description&#x20;

phoneNumber?: `string :` Customers phone number

&#x20;cashbackAmount?: `string` : Cashback amount to be given.&#x20;

\
Accepts `commandCallback : CommandCallbackFunction : (command: string) => void.` Callback function to be passed if commands are required which are generated by payment device.

***

Returns `TransactionReceiptData`

```typescript
date: string;
approvalCode: string;
appVersion: string;
businessName: string;
retrievalReferenceNumber: string;
deviceId: number;
responseCode: string;
issuerCTI: string;
merchantTidVisibility: number;
'9F12': string;
merchantId: string;
'9F11': string;
appId: string;
appPerName: string;
timestampGMT: string;
fullCardType: string;
acquirerName: string;
batchNumber: string;
longitude: string;
ac: string;
receivingInstitutionCode: string;
transactionID: string;
firstName: string;
tvr: string;
custMaskedCardNumber: string;
tipOption: string;
tgTransactionID: string;
creditDebitCardType: string;
billNumber: string;
applicationId: string;
processingFeeMode: string;
cardNumber: string;
acquirerLogo: string;
statusCode: string;
cid: string;
latitude: string;
offlineCounter: string;
custTidVisibility: number;
terminalId: string;
tsi: string;
creditDebitCardTypeName: string;
result: string;
processingMerchantCode: string;
expiryDate: string;
refTransactionType: string;
appLabel: string;
invoiceNumber: string;
currency: string;
cashBackAmount: string;
tgName: string;
cashBack: string;
issuerBankName: string;
amount: string;
merchantMidVisibility: number;
cardHolderName: string;
address2: string;
tipAmount: string;
transactionStatus: string;
transactionMode: string;
address1: string;
cardType: string;
custMidVisibility: number;
'9F06': string;
message: string;
balanceAmount: string;
transactionType: number;
isPinVerified: boolean;
stan: string;
time: string;
isSignatureRequired: boolean;
orderId: string;
shipperId: string;
transType: string;
```

### 6. printChargeSlip

```typescript
printChargeSlip(printChargeSlipInput: PrintChargeSlipInput): Promise<void>
```

Prints charge slip of the transaction.

***

Accepts : `printChargeSlipInput : PrintChargeSlipInput` :&#x20;

`transactionId : string` : Transaction id for which charge slip needs to be printed.

`isMerchantCopy : boolean` : To print merchant copy if true, customer copy if false

`isDuplicateCopy : boolean` : To print duplicate charge slip<br>

***

Returns `void`

### 7. isAutoPrintEnabled

```typescript
isAutoPrintEnabled() : Promise<boolean>
```

Checks if auto print is enabled or not.&#x20;

***

Returns `boolean`
