Get Bank List API
The Bank List API retrieves available banks and payment options for a merchant, requiring a Base64-encoded merchant domain and an optional payment mode filter. It returns a JSON response with details like bank codes, names, transaction limits, and EMI plans for a successful request.
https://kraken.airpay.co.in/airpay/pay/v4/api/banks/?token=<access_token>Request Body
Section titled “Request Body”| Parameter | Type Value | Description | Value Like |
|---|---|---|---|
| mer_dom required | Alphanumeric (10) | Base64 encoded merchant domain. | aHR0cDovL2xvY2FsaG9zdA== |
| chmod optional | Chars | Payment Mode ppc - prepaid card pg - payment gateway nb - Netbanking cash - Cash emi - EMI upi - UPI btqr - Bharat QR payltr - Pay later va - Virtual account enach - eNACH chmod variable contains Payment Modes available for user. for e.g. If you want to show only Credit Card/Debit Card, then value of the chmod variable will be “pg”. If you want Netbanking and Prepaid card then value of the chmod variable will be “nb_ppc”. If you want to show all payment options activated for you at airpay, then leave this variable blank. Allowed values: pg, ppc, nb, cash, emi, upi, btqr, payltr, va and enach. | pg |
Success 200
Section titled “Success 200”| Parameter | Type Value | Description | Value Like |
|---|---|---|---|
| chmod required | Alphanumeric | Channel of Payment. | emi |
| channel_name required | Alphanumeric | Channel of Payment. | EMI |
| title required | Alphanumeric | Channel of Payment. | EMI |
| description required | Alphanumeric | Description of Channel of Payment. | Pay with EMI |
| banks optional | Chars | [ { “bank_code”: “HDFCEMI”, “bank_name”: “HDFC”, “min_amount”: "", “max_amount”: "", “plans”: { “credit”: [ { “tenure_id”: 7, “tenure”: 3, “interest_percentage”: 3, “min_amount”: 1, “max_amount”: 1000 } ] } }, { “bank_code”: “EPAYLTR”, “bank_name”: “EPAYLATER”, “min_amount”: “1.00”, “max_amount”: “1000.00” } ] bank_code - BANK_CODE bank_name - BANK_NAME min_amount - Min allowed amount max_amount - Max allowed amount tenure_id – Tenure ID For emi tenure – emi tenure interest_percentage – emi interest percentage min_amount – min allowed amount for a plan max_amount - max allowed amount for a plan | json array with values |
<?php
$mercid = <merchant_id>;$username = <username>;$password = <password>;$secret = <secret>;$client_id = <client_id>;$client_secret = <client_secret>;
$privatekey = hash('SHA256', $secret . '@' . $username . ":|:" . $password);$request = array();
$data = [];$data['mer_dom'] = base64_encode('http://localhost');$data['chmod'] = 'ppc';
$tokenUrl = "https://kraken.airpay.co.in/airpay/pay/v4/api/oauth2";$request['client_id'] = $client_id;$request['client_secret'] = $client_secret;$request['grant_type'] = 'client_credentials';$request['merchant_id'] = $mercid;
$secretKey = md5($username . "~:~" . $password);$encre = aes256encrypt(json_encode($request), 'aes-256-cbc', $username, $password);$req = [ 'merchant_id' => $mercid, "encdata" => $encre, "checksum" => checksumcal($request)];
$access_token = sendPostData($tokenUrl, $req);$decryptData = decrypt(json_decode($access_token, true), $secretKey);$tokenResponse = json_decode($decryptData, true);
if ((isset($tokenResponse['success']) && !$tokenResponse['success']) || empty($access_token) || empty(trim($access_token))) { echo $tokenResponse['msg']; exit;}
$accessToken = $tokenResponse['data']['access_token'];
$checksumReq = checksumcal($data);$dataJson = json_encode($data);$request_data = [ 'encdata' => aes256encrypt($dataJson, 'aes-256-cbc', $username, $password), 'merchant_id' => $mercid, 'privatekey' => $privatekey, 'checksum' => $checksumReq ];$response = sendPostData('https://kraken.airpay.co.in/pay/v4/api/banks/?token=' . $accessToken, $request_data, 'POST');$responseArr = json_decode($response, true);$encdata = $responseArr['response'];
$iv = substr($encdata, 0, 16);$encdata = substr($encdata, 16);$decrypted_data = openssl_decrypt(base64_decode($encdata), 'aes-256-cbc', $secretKey, $options = OPENSSL_RAW_DATA, $iv);$result = json_decode($decrypted_data);echo json_encode($result);
function aes256encrypt($data, $cipher = 'aes-256-cbc', $username, $password){ $key = md5($username . "~:~" . $password); $iv = bin2hex(openssl_random_pseudo_bytes(8)); $encrypted = openssl_encrypt($data, $cipher, $key, $options = OPENSSL_RAW_DATA, $iv); $encryptedData = base64_encode($encrypted); return $iv . $encryptedData;}function sendPostData($tokenUrl, $postData){ $ch = curl_init($tokenUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData)); $response = curl_exec($ch); curl_close($ch); return $response;}function checksumcal($postData){ ksort($postData); $data = ''; foreach ($postData as $key => $value) { $data .= $value; } $data = $data . date('Y-m-d'); $checksum = hash('SHA256', $data); return $checksum;}function decrypt($requestData, $secretKey){ $data = $requestData['response']; error_log("sk encdata" . $requestData['response'] . "secret" . $secretKey); $iv = substr($data, 0, 16); $encryptedData = substr($data, 16); $raw = openssl_decrypt(base64_decode($encryptedData), 'AES-256-CBC', $secretKey, OPENSSL_RAW_DATA, $iv); return $raw;}Success Response
Section titled “Success Response”{ "status_code": "200", "response_code": "00", "status": "success", "message": "success", "data": [ { "chmod": "ppc", "channel_name": "PPC", "title": "Wallet", "description": "Pay with your digital wallet for quick transactions.", "banks": [ { "bank_code": "AMAZON", "bank_name": "AMAZONPAY", "min_amount": "1.00", "max_amount": "100000.00" }, { "bank_code": "HDFCPP", "bank_name": "HDFC", "min_amount": "1.00", "max_amount": "100000.00" }, { "bank_code": "MOBIKWIK", "bank_name": "MOBIKWIK", "min_amount": "1.00", "max_amount": "200000.00" }, { "bank_code": "MPSA", "bank_name": "MPESA", "min_amount": "1.00", "max_amount": "10000.00" }, { "bank_code": "PHONEPE", "bank_name": "PHONEPE", "min_amount": "1.00", "max_amount": "500000.00" } ] } ]}