---
title: Simple Transaction Integration
description: Redirect customers to airpay's payment page for completing payments.
---

In a simple transaction flow, the customer is redirected to the Airpay payment page to complete the payment.

> **Note:** If specific payment modes are passed using `chmod`, only those payment options will be shown to the customer.

---

## Endpoint

```http
POST https://payments.airpay.co.in/pay/index.php
```

---

## Headers

| Header       | Type   | Value                               |
| ------------ | ------ | ----------------------------------- |
| Content-Type | String | `application/x-www-form-urlencoded` |

---

| Field             | Type                         | Required | Description                                          |
| ----------------- | ---------------------------- | -------- | ---------------------------------------------------- |
| `buyerEmail`      | Email                        | Yes      | Buyer email address. Length: `6-50`                  |
| `buyerPhone`      | Numeric / Space / Hyphen     | Yes      | Buyer phone number. Length: `8-15`                   |
| `buyerFirstName`  | Alphanumeric / Space         | Yes      | Buyer first name. Length: `1-50`                     |
| `buyerLastName`   | Alphanumeric / Space         | Yes      | Buyer last name. Length: `1-50`                      |
| `buyerAddress`    | Alphanumeric / Space         | No       | Buyer address. Length: `4-50`                        |
| `buyerCity`       | Alphanumeric / Space         | No       | Buyer city. Length: `2-50`                           |
| `buyerState`      | Alphanumeric / Space         | No       | Buyer state. Length: `2-50`                          |
| `buyerCountry`    | Alphanumeric / Space         | No       | Buyer country. Length: `2-50`                        |
| `buyerPinCode`    | Alphanumeric                 | No       | Buyer pin code. Length: `4-8`                        |
| `orderid`         | Alphanumeric                 | Yes      | Unique order ID. Length: `1-25`                      |
| `amount`          | Numeric                      | Yes      | Transaction amount with 2 decimals. Format: `123.45` |
| `UID`             | Alphanumeric                 | Yes      | Unique user identifier from merchant                 |
| `privatekey`      | Alphanumeric                 | Yes      | Private key generated from merchant credentials      |
| `mercid`          | Numeric                      | Yes      | Merchant ID                                          |
| `vpa`             | Alphanumeric                 | No       | Virtual Payment Address. Required for UPI            |
| `kittype`         | Alphanumeric                 | Yes      | Integration type being used                          |
| `chmod`           | Chars                        | No       | Payment mode restriction                             |
| `checksum`        | Alphanumeric                 | Yes      | Checksum hash                                        |
| `currency`        | Numeric                      | No       | Numeric currency code. Example: `356`                |
| `isocurrency`     | Chars                        | No       | ISO currency code. Example: `INR`                    |
| `token`           | Alphanumeric                 | No       | Token value if tokenization is enabled               |
| `customvar`       | Alphanumeric / Space / Equal | No       | Custom metadata. Max length `120`                    |
| `txnsubtype`      | Numeric                      | No       | Transaction subtype                                  |
| `wallet`          | Numeric                      | No       | Wallet update flag                                   |
| `upi_tpv_account` | Numeric                      | No       | UPI TPV account number                               |
| `upi_tpv_ifsc`    | Alphanumeric                 | No       | IFSC code for TPV account                            |

---

# `kittype` Values

Possible values for `kittype`:

```text
inline
iframe
server_side_sdk
mobile
cs-cart
drupal
joomla
magento
opencart
shopify
wordpress
prestashop
```

---

# Payment Modes (`chmod`)

| Value    | Description     |
| -------- | --------------- |
| `ppc`    | Prepaid Card    |
| `pg`     | Payment Gateway |
| `nb`     | Net Banking     |
| `pgcc`   | Credit Card     |
| `pgdc`   | Debit Card      |
| `cash`   | Cash            |
| `emi`    | EMI             |
| `rtgs`   | RTGS            |
| `upi`    | UPI             |
| `btqr`   | Bharat QR       |
| `payltr` | Pay Later       |
| `va`     | Virtual Account |
| `enach`  | eNACH           |
| `remit`  | Remittance      |

### Examples

Show only Credit/Debit cards:

```text
chmod=pg
```

Show Net Banking + Prepaid Cards:

```text
chmod=nb_ppc
```

Show all enabled payment methods:

```text
Leave chmod blank
```

---

# Private Key Generation

```php
$privatekey = hash(
    'sha256',
    $secret . '@' . $username . ':|:' . $password
);
```

---

# Checksum Generation

## Standard Transactions

### Step 1: Generate Key

```php
$key = hash(
    'SHA256',
    $username . "~:~" . $password
);
```

### Step 2: Generate Hash

```php
$alldata =
    $buyerEmail .
    $buyerFirstName .
    $buyerLastName .
    $buyerAddress .
    $buyerCity .
    $buyerState .
    $buyerCountry .
    $amount .
    $orderid .
    $UID;

$checksum = hash(
    'SHA256',
    $key . '@' . $alldata
);
```

---

# Subscription Transactions

If subscription fields are included:

```text
siindexvar =
sb_nextrundate .
sb_frequency .
sb_period .
sb_amount .
sb_isrecurring .
sb_recurringcount .
sb_retryattempts
```

Date format:

```text
YYYY-MM-DD
```

### Subscription Hash Data

```php
$alldata =
    $buyerEmail .
    $buyerFirstName .
    $buyerLastName .
    $buyerAddress .
    $buyerCity .
    $buyerState .
    $buyerCountry .
    $amount .
    $orderid .
    $UID .
    $siindexvar .
    $date;
```

---

# Subscription Parameters

| Field               | Type        | Description                           |
| ------------------- | ----------- | ------------------------------------- |
| `sb_nextrundate`    | Date        | Next subscription date (`MM/DD/YYYY`) |
| `sb_period`         | `D/W/M/Y/A` | Day / Week / Month / Year / Adhoc     |
| `sb_frequency`      | Numeric     | Subscription frequency                |
| `sb_amount`         | Numeric     | Subscription amount                   |
| `sb_isrecurring`    | Numeric     | Recurring enabled flag                |
| `sb_recurringcount` | Numeric     | Total recurring count                 |
| `sb_retryattempts`  | Numeric     | Retry attempts                        |
| `sb_maxamount`      | Numeric     | Maximum chargeable amount             |

> `sb_nextrundate` must be current date + 1 day (`T+1`)

---

# Transaction Subtypes (`txnsubtype`)

| Value | Description             |
| ----- | ----------------------- |
| `1`   | INR Auth Capture        |
| `2`   | INR Sale Auth           |
| `3`   | INR Moto                |
| `4`   | INR Moto Auth Capture   |
| `5`   | INR Sale DCC            |
| `6`   | INR DCC Auth Capture    |
| `7`   | INR 3 Months EMI        |
| `8`   | INR 6 Months EMI        |
| `9`   | INR 9 Months EMI        |
| `10`  | INR 12 Months EMI       |
| `11`  | INR 18 Months EMI       |
| `12`  | INR Subscription        |
| `13`  | INR 24 Months EMI       |
| `36`  | INR 36 Months EMI       |
| `74`  | INR 3 Months Debit EMI  |
| `75`  | INR 6 Months Debit EMI  |
| `76`  | INR 9 Months Debit EMI  |
| `77`  | INR 12 Months Debit EMI |

---

# Wallet Flag

| Value | Description            |
| ----- | ---------------------- |
| `0`   | Default                |
| `1`   | Update consumer wallet |

---

# Request Example

```json
{
  "buyerEmail": "buyer@example.com",
  "buyerPhone": "9898989989898",
  "buyerFirstName": "Sam",
  "buyerLastName": "Johan",
  "buyerAddress": "3rd floor, Trust House Bldg. Dr. E.Borges Road",
  "buyerCity": "Mumbai",
  "buyerState": "Maharashtra",
  "buyerCountry": "India",
  "buyerPinCode": "400083",
  "orderid": "d3t54978",
  "amount": 123.45,
  "UID": "ehrjdsihogfoejroejfrjwfw9f9ewu49r4m4t9rrtj04",
  "privatekey": "71a4efaf21c79864ec154babfc494f45fd1f65a570805084965d5b29486f1dfe",
  "mercid": 767807,
  "chmod": "enach",
  "vpa": "payupi@okicici",
  "kittype": "inline",
  "checksum": "5f593008470bfdcbb0f9c518d79af129bb6fa712",
  "currency": 356,
  "isocurrency": "INR",
  "token": "",
  "sb_nextrundate": "03/08/2022",
  "sb_period": "W",
  "sb_frequency": 1,
  "sb_amount": 10.00,
  "sb_isrecurring": 1,
  "sb_recurringcount": 5,
  "sb_retryattempts": 0,
  "sb_maxamount": 10.00,
  "txnsubtype": 2,
  "wallet": 0
}
```

---

# Success Response

## HTTP Status

```http
HTTP/1.1 200 OK
```

---

# Response Fields

| Field                      | Description                |
| -------------------------- | -------------------------- |
| `TRANSACTIONPAYMENTSTATUS` | Payment status             |
| `MERCID`                   | Merchant ID                |
| `TRANSACTIONID`            | Merchant order ID          |
| `APTRANSACTIONID`          | Airpay transaction ID      |
| `TXN_MODE`                 | LIVE or Sandbox            |
| `CHMOD`                    | Payment channel            |
| `AMOUNT`                   | Transaction amount         |
| `CURRENCYCODE`             | Currency code              |
| `TRANSACTIONSTATUS`        | Numeric transaction status |
| `MESSAGE`                  | Transaction message        |
| `CUSTOMER`                 | Customer name              |
| `CUSTOMERPHONE`            | Customer phone             |
| `CUSTOMEREMAIL`            | Customer email             |
| `TRANSACTIONTYPE`          | Transaction type           |
| `RISK`                     | Risk flag                  |
| `BILLEDAMOUNT`             | Total billed amount        |
| `SUBSCRITIONID`            | Subscription ID            |
| `SUBSCRIPTIONNEXTRUNDATE`  | Next subscription date     |
| `TOKEN`                    | Token string               |
| `CUSTOMERVPA`              | UPI VPA                    |
| `TRANSACTIONTIME`          | Transaction time           |
| `CARDISSUER`               | Card issuer                |
| `CARD_NUMBER`              | Masked card number         |
| `CARDUNIQUECODE`           | Unique card code           |
| `BANKNAME`                 | Bank name                  |
| `CARDCOUNTRY`              | Card issuing country       |
| `CARDTYPE`                 | Credit / Debit             |
| `BANKRESPONSEMSG`          | Bank response message      |
| `REASON`                   | Failure reason             |
| `ap_SecureHash`            | Airpay secure hash         |

---

# Transaction Status Codes

| Status     | Code  | Description                         |
| ---------- | ----- | ----------------------------------- |
| Success    | `200` | Transaction successful              |
| In Process | `211` | Transaction processing              |
| Failed     | `400` | Transaction failed                  |
| Dropped    | `401` | Transaction not registered properly |
| Cancelled  | `402` | Payment cancelled                   |
| Incomplete | `403` | No callback received from bank      |
| Bounced    | `405` | Transaction bounced                 |
| No Records | `503` | No records found                    |

---

# Transaction Types

| Code  | Description             |
| ----- | ----------------------- |
| `310` | Mandate Approved / Auth |
| `320` | Sale                    |
| `330` | Capture                 |
| `340` | Refund                  |
| `350` | Chargeback              |
| `360` | Reversal                |
| `370` | Sale Complete           |
| `380` | Sale Adjust             |
| `390` | Tip Adjust              |
| `400` | Sale + Cash             |
| `410` | Cashback                |
| `420` | Void                    |
| `430` | Release                 |
| `440` | Cash Withdrawal         |

---

# Response Secure Hash Validation

## UPI Transactions

```php
crc32(
    TRANSACTIONID . ':' .
    APTRANSACTIONID . ':' .
    AMOUNT . ':' .
    TRANSACTIONSTATUS . ':' .
    MESSAGE . ':' .
    MID . ':' .
    USERNAME . ':' .
    CUSTOMERVPA
);
```

## Non-UPI Transactions

```php
crc32(
    TRANSACTIONID . ':' .
    APTRANSACTIONID . ':' .
    AMOUNT . ':' .
    TRANSACTIONSTATUS . ':' .
    MESSAGE . ':' .
    MID . ':' .
    USERNAME
);
```

---

# Success Response Example

```json
{
  "TRANSACTIONPAYMENTSTATUS": "SUCCESS",
  "MERCID": "18999",
  "TRANSACTIONID": "TestOrder24",
  "APTRANSACTIONID": "17691556",
  "TXN_MODE": "LIVE",
  "CHMOD": "pg",
  "AMOUNT": "1.00",
  "CURRENCYCODE": "356",
  "TRANSACTIONSTATUS": "200",
  "MESSAGE": "Success",
  "CUSTOMER": "SANEESH",
  "CUSTOMERPHONE": "8287456879",
  "CUSTOMEREMAIL": "SANEESH.KUTTAPPAN@AIRPAY.CO.IN",
  "TRANSACTIONTYPE": "320",
  "RISK": "0",
  "BILLEDAMOUNT": "1.00",
  "TOKEN": "446FVcGpJbhmlNH4KyFl2He8nblrfeUk",
  "TRANSACTIONTIME": "27-07-2022 12:48:00",
  "CARDISSUER": "visa",
  "CARD_NUMBER": "462294XXXXXX3713",
  "CARDUNIQUECODE": "SLzvR9xdUuLvG0EgnqYxOqUA2g6gi7Fi",
  "BANKNAME": "anz bank",
  "CARDCOUNTRY": "australia",
  "CARDTYPE": "Credit",
  "BANKRESPONSEMSG": "Success",
  "ap_SecureHash": "3901005794"
}
```