---
title: Get Token API
description: Retrieve the token associated with a wallet user for use in the merchant application.
---

This API retrieves the token associated with a user for use in the merchant application. It requires merchant ID, private key, buyer's email, buyer phone, and optional UID. A successful request returns the transaction status, token, and user details.

#### POST
```
https://kraken.airpay.co.in/airpay/wallet/api/walletGetToken.php
```

## Header

| Parameter | Type Value | Description | Value Like |
| --- | --- | --- | --- |
| Content-Type  required | String | The Content-Type header indicates the media type of the request or response body so the receiver knows how to process the data. | `application/x-www-form-urlencodeds` |

## Request Body

| Parameter | Type Value | Description | Value Like |
| --- | --- | --- | --- |
| merchant_id  required | Number  <br>(1-20) | Merchant ID | `18999` |
| private_key  required | String  <br>(10-200) | Private Key, generated as hash('sha256', secret.'@'.username.':|:'.password) | `53b7602609702bf0055437c5edec157b23f3ace90d34fcf07275872b2350e7d5` |
| buyer_email  required | String  <br>(6-50) | Email of wallet user | `aatest12@gmail.com` |
| buyer_phone  required | String  <br>(10-15) | Mobile number of the wallet user (numeric, spaces, or hyphens allowed) | `9234337892` |
| UID  optional | String | Merchant-generated Unique User ID (optional) | `1234` |
| outputFormat  optional | String  <br>(1-3) | Response format: json or xml (default: xml) | `xml` |
| checksum  required | String  <br>(10-100) | MD5 hash: md5(merchant_id.buyer_email.buyer_phone.UID.date('Y-m-d').private_key) | `72ce8cfbb1347905c34e121336bb3d09` |

## Success 200

| Parameter | Type Value | Description | Value Like |
| --- | --- | --- | --- |
| TRANSACTIONSTATUS  required | Number | Transaction status code: 200: Success (Transaction is successful)211: Transaction in Process (Transaction is processing)400: Failed (Transaction failed)401: Dropped (Transaction did not register properly)402: Cancel (Payment not yet processed)403: Incomplete (No callback received from bank)405: Bounced (Transaction bounced)503: No Records (No records found) |
| MESSAGE  required | String | Response message from the payment gateway (e.g., "Successful", "Invalid checksum") |
| CHMOD  required | String | Transaction channel mode (always "wallet") | `wallet` |
| MERCHANTID  required | String | Merchant ID | `18999` |
| CUSTOMEREMAIL  required | String | Email of the wallet user |
| CUSTOMERPHONE  required | String | Mobile number of the wallet user |
| TOKEN  required | String | Token associated with the wallet user |

## Request Example

```
curl --location 'https://kraken.airpay.co.in/airpay/wallet/api/walletGetToken.php' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'merchant_id=18999' \
--data-urlencode 'private_key=53b7602609702bf0055437c5edec157b23f3ace90d34fcf07275872b2350e7d5' \
--data-urlencode 'buyer_email=aatest12@gmail.com' \
--data-urlencode 'buyer_phone=9234337892' \
--data-urlencode 'UID=1234' \
--data-urlencode 'checksum=72ce8cfbb1347905c34e121336bb3d09'
```

### Success Response (JSON)

```json
HTTP/1.1 200 OK
{
  "TRANSACTION": {
    "TRANSACTIONSTATUS": 200,
    "MESSAGE": "Successful",
    "CHMOD": "wallet",
    "MERCHANTID": "18999",
    "CUSTOMEREMAIL": "aatest12@gmail.com",
    "CUSTOMERPHONE": "9234337892",
    "TOKEN": "53b7602609702bf0055437c5edec157b23f3ace90d34fcf07275872b2350e7d5"
  }
}
```

### Success Response (XML)

```xml
<?xml version="1.0" encoding="UTF-8"?>
<RESPONSE>
  <TRANSACTION>
    <TRANSACTIONSTATUS>200</TRANSACTIONSTATUS>
    <MESSAGE>Successful</MESSAGE>
    <CHMOD>wallet</CHMOD>
    <MERCHANTID>18999</MERCHANTID>
    <CUSTOMEREMAIL>aatest12@gmail.com</CUSTOMEREMAIL>
    <CUSTOMERPHONE>9234337892</CUSTOMERPHONE>
    <TOKEN>53b7602609702bf0055437c5edec157b23f3ace90d34fcf07275872b2350e7d5</TOKEN>
  </TRANSACTION>
</RESPONSE>
```

### Error Response (JSON)

```json
HTTP/1.1 200 OK
{
  "TRANSACTION": {
    "TRANSACTIONSTATUS": "400",
    "MESSAGE": "Invalid checksum"
  }
}
```

### Error Response (XML)

```xml
<?xml version="1.0" encoding="UTF-8"?>
<RESPONSE>
  <TRANSACTION>
    <TRANSACTIONSTATUS>400</TRANSACTIONSTATUS>
    <MESSAGE>Invalid checksum</MESSAGE>
  </TRANSACTION>
</RESPONSE>
```