1.5 Refund

The endpoint is:
https://apis.ipayafrica.com/payments/v2/transaction/refund

The parameters needed for this are as follows:

Parameter Name Data Type(Data Length) Description Required
code alphanumeric (64) The transaction code to be refunded Y
vid alphanumeric(12) The iPay Merchant vendor id Y
hash alphanumeric(64) A digital signature hash of the data for verification. Y

if you do not have funds or available in your c2b account, your b2c account ( bulkpay ) will be considered if neither is present then the refund will fail.

The hash is generated from a datastring which is a http string key value pair of the parameters: code, vid in alphabetical order it is a HMAC with the sha256 hashing algorithm. Sample PHP script of the same is show below:


<?php
//your SECRET KEY 
$key "SECretKey";
$datastring "code=code&vid=vid";
/*********************************************************************************************************/

$generated_hash hash_hmac('sha256',$datastring $key);
/**********************************************************************************************************/
?>

Response

Expected Response on Successfull card transaction.

status 200 is success any other should be treated as a failure


{
    "status": 200,
    "c2bfunds": "1100.00",
    "b2cfunds": "8164.00",
    "amount": "50.00",
    "code": "1539630706A",
    "text": "Refund done",
    "email_response": "Mail sent succesfully"
}