5. Refund Request
API to request the refund for the paid transactions.
API Endpoints
Production Base URL /api/GenToken/Refund
Sample Request & Response
{
"merchantCode":"xxxxx",
"authKey":"xxxxxxxxx",
"ReferenceID":"(15 digit number passing during the payment creation)",
"hash":"ComputedHash(To be calculated as described below)",
"Amount":1,
"Description":"optional",
"RequestedBy":"optional"
}
Hash Creation
Use the below string format to generate an hash value using Hashing Key.
Amount + AuthenticationKey + MerchantCode + ReferenceID
Response Parameters
Parameters
Data Type
Description
errorCode
Integer
0 is success 1 is failed and 2 is initiated for manual refund
errorMessage
String
result -> IsRefunded
Integer
1 is refunded | 2 is under process | 0 is rejected
Merchant will receive an email from Og regarding the updates (under process, cancelled and refunded) of refund.
Sample Code to post data
public async Task> RefundPayment(RefundPaymentRequest obj)
{
Output dto = new Output();
var url = {Provided End Point};
var client = new HttpClient();
client.BaseAddress = new Uri(url);
try
{
obj.hash = ComputeHash(obj);
var resultser = JsonConvert.SerializeObject(obj);
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8");
var response = client.PostAsJsonAsync(url, obj).Result;
if (response.IsSuccessStatusCode)
{
var ss = response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject>(ss.Result);
dto = result;
}
else
{
var ss = response.Content.ReadAsStringAsync();
var resps = ss.Result.ToString();
}
}
catch (HttpRequestException ex)
{
}
return dto;
}
Last updated
Was this helpful?