---
title: Embedded Transaction
description: Allow customers to select payment options on the merchant's page directly.
---

In embedded (directindex) transactions, the user will be selecting the payment option on the merchant's page itself instead of being redirected to AirPay's payment page for completing the payment.

#### POST

```
https://payments.airpay.co.in/pay/v4/embedded/?token=<access_token>
```

## Request Body

| Parameter | Type Value | Description | Value Like |
| --- | --- | --- | --- |
| orderid  required | Alphanumeric  <br>(1-30) | Merchant generated transaction id | `ORD1234` |
| amount  required | Numeric  <br>(1-10 .2) | Amount with two decimals | `100.00` |
| currency_code  required | Numeric  <br>(3) | Numeric currency code | `356` |
| iso_currency  required | String  <br>(3) | ISO Currency code | `inr` |
| buyer_email  required | Email  <br>(3-50) | Buyer Email | `customer@example.com` |
| buyer_phone  required | Numeric  <br>(8-15) | Buyer Phone | `99999999` |
| buyer_firstname  required | Alphanumeric  <br>(1-50) | Buyer First Name | `John` |
| buyer_lastname  required | Alphanumeric  <br>(1-50) | Buyer Last Name | `Doe` |
| buyer_address  optional | Alphanumeric  <br>(1-50) | Chapman, 711-2880 Nulla St.] Buyer Address | `Cecilia` |
| buyer_city  optional | Alphanumeric  <br>(1-50) | Buyer City | `Mankato` |
| buyer_state  optional | Alphanumeric  <br>(1-50) | Buyer State | `Mississippi` |
| buyer_pincode  optional | Alphanumeric  <br>(4-8) | Buyer Pincode | `96522` |
| buyer_country  optional | Alphanumeric  <br>(2-50) | Buyer Country | `USA` |
| customvar  optional | Alphanumeric|Space|Equal  <br>(1-4096) | Any additional information that an affiliate can pass for tracking or custom processing. | `1234567|test|ABC1234` |
| chmod  optional | Chars | Payment Mode<br>ppc - prepaid card<br>pg - payment gateway<br>nb - Netbanking<br>pgcc - Credit card<br>pgdc - Debit card<br>cash - Cash<br>emi - EMI<br>rtgs - RTGS<br>upi - UPI<br>btqr - Bharat QR<br>payltr - Pay later<br>va - Virtual account<br>enach - eNACH<br>remit - Remittance<br>Allowed values:  `pg`,   `ppc`,   `nb`,   `pgcc`,   `pgdc`,   `cash`,   `emi`,   `rtgs`,   `upi`,   `btqr`,   `payltr`,   `va`,   `enach`,   `remit` | `pg` |
| txnsubtype  optional | Numeric | Transaction SubType, type of transaction.<br>Allowed values:  `1`,   `2`,   `3`,   `4`,   `5`,   `6`,   `7`,   `8`,   `9`,   `10`,   `11`,   `12`,   `13`,   `36`,   `74`,   `75`,   `76`,   `77` | `2` |
| wallet  optional | Numeric | Transaction Wallet Default - 0 1 – Load consumer Wallet 2 – Debit consumer wallet<br>Allowed values:  `0`,   `1{1}` | `0` |
| utility_biller_name  optional | Alphanumeric  <br>(2-50) | The Utility Biller Name parameter shall be mandatory for transactions with the following Merchant Category Codes (MCCs):<br>4900, 6012, 6051, 6300, 6513, 8011, 8050, 8062, 8099, 8111, 8211, 8220, 8241, 8244, 8249, 8299, 8351, 9311. |
| channel  required | Alphaumeric | Payment Type<br>pg - pg<br>nb - net banking<br>ppc - Wallet(ppc)<br>rtgs - RTGS<br>emi - EMI<br>upi - UPI<br>cash - cash<br>virtual-acc - Virtual Account<br>Allowed values:  `pg`,   `nb`,   `ppc`,   `rtgs`,   `emi`,   `upi`,   `cash`,   `virtual-acc{2-11}` | `pg` |
| uid  optional | Alphanumeric  <br>(1-32) | Unique user identifier from merchant |
| utr  required | Alphanumeric  <br>(16-22) | Unique Transaction Reference No<br>If channel is "rtgs" | `3213213124` |
| customer_vpa  required | Alphanumeric  <br>(1-25) | Customer Virtual Payment Address (required in UPI) | `test@okhdfcbank` |
| walletflg  required | Chars  <br>(1) | If the payment is wallet (Y, N) | `N` |
| billed_amount  optional | Numeric  <br>(1-10 .2) | billed amount with two decimals |
| surcharge_amount  optional | Numeric  <br>(1-10 .2) | Surcharge amount of this transaction (sending only if applicable) |
| token  optional | Alphanumeric  <br>(2-30) | Token (if token is enabled) |
| token_expiry  optional | String  <br>(2-30) | Token Expiry (if token is enabled) |
| token_cryptogram  optional | String | Cryptogram generated by token requestor.    Only in case of channel is pg |
| mer_dom  optional | Alphanumeric | Base64 encoded merchant domain. | `aHR0cDovL2xvY2FsaG9zdA==` |
| bank_code  optional | Alphanumeric  <br>(1-20) | Bank Code. If channel is "ppc" or "nb" or "EMI" |
| emitenure  optional | Numeric  <br>(2) | EMI Tenure<br>If channel is "emi" |
| card_number  required | Numeric  <br>(12-19) | Card Number/ or Token in case of tokenized transaction (required for pg and emi). | `6321***3123` |
| card_cvv  required | Numeric  <br>(3-4) | Card CVV (required for pg and emi) | `123` |
| card_scheme  optional | String  <br>(1-50) | Card scheme (rupay,visa,mastercard etc…) |
| savecard  optional | Chars  <br>(1) | Y – For saving card in tokenized format. |
| carduniquecode  optional | Alphaumeric  <br>(3-64) | Card unique code. If channel is "pg" and carduniquecode is not empty |
| expiry_mm  required | Numeric  <br>(2) | Card Card Expiry Month (required for pg and emi) |
| expiry_yy  required | Numeric  <br>(2) | Card Expiry Year (required for pg and emi) |
| sb_nextrundate  optional | Date  <br>(103) | Next subscription date (for enabling subscription)(for txnsubtype INR-SI) mm/dd/yyyy date must be current date+1 (t+1) |
| sb_period  optional | Chars  <br>(1) | Subscription period (for enabling subscription) (for txnsubtype INR-SI) Day/Week/Month/Year/Adhoc |
| sb_frequency  optional | Numeric  <br>(1-3) | Subscription frequency (for enabling subscription) (for txnsubtype INR-SI) |
| sb_amount  optional | Numeric  <br>(1-10 .2) | Subscription amount (for enabling subscription) (for txnsubtype INR-SI) |
| sb_isrecurring  optional | Numeric  <br>(1) | Is subscription recurring (for enabling subscription) (for txnsubtype INR-SI) |
| sb_recurringcount  optional | Numeric  <br>(1-3) | Subscription Recurring Count (for enabling subscription and Is Subscription Recurring is Yes , if recurring count is 999 than subscription is set as never ending end date its apply only for enach transaction) (for txnsubtype INR-SI) |
| sb_retryattempts  optional | Numeric  <br>(1) | Subscription retry attempts ( for enabling subscription) (for txnsubtype INR-SI) |
| sb_maxamount  optional | Numeric  <br>(1-10 .2) | Maximum amount can char (for txnsubtype INR-SI) |
| upi_tpv_account  optional | Numeric  <br>(12-18) | Bank Account number passed within this parameter will be used for restricting the Payments accepted to the UPI Account linked with mentioned bank account number. Any other Bank account used to complete the UPI transaction will be rejected. Please contact the airpay support team to enable this. |
| upi_tpv_ifsc  optional | Alphanumeric  <br>(1-11) | The IFSC code of the UPI TPV account number is mandatory if the upi_tpv_account is being activated. |
| customer_consent  required | chars  <br>(1) | Consent flag to be sent by Merchant.<br>Allowed values:  `Y`,   `N` | `Y` |

## Success 200

| Parameter | Type Value | Description | Value Like |
| --- | --- | --- | --- |
| ap_transactionid  required | Numeric | airpay transaction reference number | `11314` |
| transaction_payment_status  required | Alphanumeric | Transaction payment status<br>SUCCESS<br>TRANSACTION IN PROCESS<br>FAILED<br>DROPPED<br>CANCEL<br>INCOMPLETE<br>BOUNCED<br>NO RECORDS | `SUCCESS` |
| merchant_id  required | Numeric | Merchant ID | `123356` |
| orderid  required | Alphanumeric | orderid you have send to airpay system | `ORDER123456` |
| txn_mode  optional | Alphanumeric | Transaction mode LIVE or Sandbox | `LIVE` |
| chmod  required | Alphanumeric | Channel of Payment done | `pg` |
| amount  required | Numeric | Transaction amount | `100.00` |
| currency_code  optional | Numeric | Payment Currency | `356` |
| transaction_status  required | Numeric | Transaction Payment Status<br>200 - Transaction is success<br>211 - Transaction is processing<br>400 - Transaction is failed<br>401 - Transaction will not register properly<br>402 - Payment that has not yet been processed<br>403 - Not received any call back from bank<br>405 - Transaction has bounced<br>503 - No records found | `200` |
| message  required | Alphanumeric | Response message received from payment gateway | `Success` |
| customer_name  optional | Alphanumeric | Customer Name | `John Doe` |
| customer_phone  optional | Alphanumeric | Customer Phone | `987654321` |
| customer_email  optional | Email | Customer Email | `customer@example.com` |
| transaction_type  optional | Numeric | Transaction Type | `320` |
| risk  optional | Boolean | If the transaction is at risk 1, otherwise 0. | `0` |
| billed_amount  optional | Numeric | Includes total amount of bill amount with two decimals | `110.00` |
| token  optional | Alphanumeric | Token string | `4efaf21c79864ec154babfc494f45fd1f65a570805084965` |
| transaction_time  optional | Date | Transaction Time | `30-11-2023 12:32:59` |
| ap_SecureHash  required | Alphanumeric | Secure hash generated by airpay | `1490948220` |
| custom_var  optional | Alphanumeric<br>(`1-120`) | Any information passed in the request, which can be received in the response exactly as it was sent. | `1234567|test|ABC1234` |
| subscription_id  optional | Alphanumeric | Subscription ID, if subscription transaction |
| subscription_next_rundate  optional | Alphanumeric | subscription next run date, if subscription transaction |

## PHP

```php
<?php
$merchant_id   = "<merchant_id>";
$username      = "<username>";
$password      = "<password>";
$secret        = "<secret>";
$secretKey     = '<secretKey>';
$data = array();
$data['buyer_email'] = 'customer@example.com';
$data['buyer_phone'] = '99999999';
$data['buyer_firstname'] = 'John';
$data['buyer_lastname'] = 'Doe';
$data['buyer_address'] = 'Cecilia Chapman, 711-2880 Nulla St.';
$data['buyer_city'] = 'Mankato';
$data['buyer_state'] = 'Mississippi';
$data['buyer_country'] = 'USA';
$data['buyer_pincode'] = '96522';
$data['orderid'] = 'ORD123456';
$data['amount'] = '10.00';
$data['channel'] = 'pg';
$data['bank_code'] = 'XYZ';
$data['currency_code'] = '356';
$data['iso_currency'] = 'inr';

$privatekey = hash('sha256', $secret . '@' . $username . ':|:' . $password);
$encdata     = encrypt(json_encode($data), $secretKey);
$checksum   = checksum($data);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3./org/1999/xhtml">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>airpay</title>
  <script type="text/javascript">
    function submitForm() {
      var form = document.forms[0];
      form.submit();
    }
  </script>
</head>

<body onload="javascript:submitForm()">
  <center>
    <table width="500px;">
      <tr>
        <td align="center" valign="middle">Do Not Refresh or Press Back <br /> Redirecting to airpay</td>
      </tr>
      <tr>
        <td align="center" valign="middle">
          <form action="https://payments.airpay.co.in/pay/v4/embedded/?token=<token>" method="#### POST">
            <input type="hidden" name="privatekey" value="<?php echo $privatekey; ?>">
            <input type="hidden" name="merchant_id" value="<?php echo $merchant_id; ?>">
            <input type="hidden" name="encdata" value="<?php echo $encdata; ?>">
            <input type="hidden" name="checksum" value="<?php echo $checksum; ?>">
          </form>
        </td>

      </tr>

    </table>

  </center>
</body>

</html>
```

### Success Response

```json
HTTP/1.1 200 OK
    {
      "status_code":"200",
      "status":"success",
      "response_code":"00",
      "message":"Success",
      "data":
     {
      "transaction_payment_status":"SUCCESS",
      "merchant_id":"123356",
      "orderid":"ORDER123456",
      "ap_transactionid":"11314",
      "txn_mode":"LIVE",
      "chmod":"pg",
      "amount":"100.00",
      "currency_code":"356",
      "transaction_status":200,
      "message":"Success",
      "bank_response_msg":"Success",
      "customer_name":"John Doe",
      "customer_phone":"987654321",
      "customer_email":"customer@example.com",
      "transaction_type":320,
      "risk":"0",
      "customvar":"0",
      "token":"",
      "uid":"U123",
      "transaction_time":"30-11-2023 12:32:59",
      "surcharge_amount":"51.41",
      "card_scheme": "visa"
      "card_number": "462294XXXXXX3713"
      "carduniquecode": "SLzvR9xdUuLvG0EgnqYxOqUA2g6gi7Fi"
      "bank_name": "anz bank"
      "card_country": "australia"
      "card_type": "Credit"
      "token":"446FVcGpJbhmlNH4KyFl2He8nblrfeUk"
      "ap_SecureHash":"1490948220"
      }
    }
```

### Error Response

```json
HTTP/1.1 200 OK
    {
     {
       "status_code":"400",
       "response_code":501,
       "status":"fail",
       "message":"Invalid Merchant Id",
       "data":[]
      }
   }
```