Refund
This API can be used to initiate refund from the merchant’s platform. The partial and full refund can be requested. For partial amount, the amount needs to be filled by the merchant.
https://kraken.airpay.co.in/airpay/pay/v4/api/refund/?token=<access_token>Header
Section titled “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
Section titled “Request Body”| Parameter | Type Value | Description | Value Like |
|---|---|---|---|
| mode required | String | Mode “refund” | refund |
| transactions optional | String | Base64 encoded refund JSON. Example data [{"ap_transactionid": 10265,"amount": "100.00"},{"ap_transactionid": 10264,"amount": "10.00"}] base64 encoded transactions W3siYXBfdHJhbnNhY3Rpb25pZCI6IDEwMjY1LCJhbW91bnQiOiAiMTAwLjAwIn0seyJhcF90cmFuc2FjdGlvbmlkIjogMTAyNjQsImFtb3VudCI6ICIxMC4wMCJ9XQ== ap_transactionid = airpay transaction reference number amount = Full/Partial refund amount | yJhbW91bnQiOiAiMTAwLjAwIiB9XQ== |
Success 200
Section titled “Success 200”| Parameter | Type Value | Description | Value Like |
|---|---|---|---|
| transactions required | Object | List of transactions | |
| ap_transactionid required | Numeric | airpay transaction reference number | 3213213212 |
| success required | String | Refund status ”true” = Successfully initiated refund. ”false” = Refund was not initiated. | false |
| message required | String | can not be performed. Refund already initiated. refund message | Refund |
| refund_id required | Numeric | Trfund reference number. | 12071 |
| mode optional | String | Mode |
<?php$merchant_id = "<merchant_id>";$username = "<username>";$password = "<password>";$secret = "<secret>";$secretKey = '<secretKey>';$data = array();$data['transactions'] = base64_encode('[{"ap_transactionid": 10265,"amount": "100.00"},{"ap_transactionid": 10264,"amount": "10.00"}]');
$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/refund/?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
Section titled “Success Response”HTTP/1.1 200 OK { "status_code": "200", "response_code": "00", "status": "Success", "message": "success", "data": { "transactions": [ { "ap_transactionid": 10265, "amount": "100.00", "success": "false", "message": "Refund can not be performed. Refund already initiated.", "refund_id": "12071" }, { "ap_transactionid": "10264", "success": "true", "message": "Transaction accepted for refund", "refund_id": "12076" } ] }}Error Response
Section titled “Error Response” HTTP/1.1 200 OK { { "status_code":"400", "response_code":501, "status":"fail", "message":"Invalid Merchant Id", "data":[] }}