---
title: Validate VPA
description: Validate a customer's UPI Virtual Payment Address before processing payment.
---

This API is for validating VPA – Virtual Private Address i.e UPI id of a customer for UPI payments online. If UPI id is not valid, then no payment can be done.

#### POST

```
https://kraken.airpay.co.in/airpay/pay/v4/api/vpavalidate/?token=<access_token>
```

## 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/json` |

## Request Body

| Parameter | Type Value | Description | Value Like |
| --- | --- | --- | --- |
| customer_vpa  required | Alphanumeric | Customer Virtual Payment Address | `test@okhdfcbank` |

## Success 200

| Parameter | Type Value | Description | Value Like |
| --- | --- | --- | --- |
| status  required | String | Status Code | `200` |
| vpa_name  required | String | VPA Name | `JACOB TARUN KOSHY` |
| message  required | String | Status Message | `Success` |

## PHP

```php
 <?php
$merchant_id   = "<merchant_id>";
$username      = "<username>";
$password      = "<password>";
$secret        = "<secret>";
$secretKey     = '<secretKey>';
$data = array();
$data['customer_vpa'] = "customer@abcbank";

$privatekey = hash('sha256', $secret.'@'.$username.':|:'.$password);
$encdata	   = encrypt(json_encode($data), $secretKey);
$checksum   = checksum($data);

$payload    = [
                'merchant_id'=>$merchant_id,
	            'encdata' => $encdata,
	            'checksum' => $checksum,
                'privatekey' => $privatekey
              ];

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://kraken.airpay.co.in/airpay/pay/v4/api/vpavalidate/?token=<access_token>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $payload
));

$result = curl_exec($curl);

curl_close($curl);
$response = json_decode($result)->response;
```

### Success Response

```json
HTTP/1.1 200 OK
 {
    "status_code": "200",
    "response_code": "00",
    "status": "Success",
    "message": "success",
    "data": {
           "status" : "200",
           "vpa_name" : "JACOB TARUN KOSHY",
           "message" : "Success",
    }
}
```

### Error Response

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