Skip to content

Refund

| View as Markdown

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>
ParameterType ValueDescriptionValue Like
Content-Type requiredStringThe Content-Type header indicates the media type of the request or response body so the receiver knows how to process the data.application/json
ParameterType ValueDescriptionValue Like
mode requiredStringMode “refund”refund
transactions optionalStringBase64 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==
ParameterType ValueDescriptionValue Like
transactions requiredObjectList of transactions
ap_transactionid requiredNumericairpay transaction reference number3213213212
success requiredStringRefund status
”true” = Successfully initiated refund.
”false” = Refund was not initiated.
false
message requiredStringcan not be performed. Refund already initiated. refund messageRefund
refund_id requiredNumericTrfund reference number.12071
mode optionalStringMode
<?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;
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"
}
]
}
}
HTTP/1.1 200 OK
{
{
"status_code":"400",
"response_code":501,
"status":"fail",
"message":"Invalid Merchant Id",
"data":[]
}
}