6, Payment Status
API to get the status of a payment
API Endpoints
Production Base URL /api/GenToken/GetStatus
Sandbox Base URL /api/GenToken/GetStatus
Sample Request & Response
{
"merchantCode":"xxxxx",
"authKey":"xxxxx",
"ReferenceID":"(15 digit number passing during the payment creation)"
}
{
"errorCode": 0,
"errorMessgae": "",
"result": {
"tranDate": "datetime",
"referenceID": "string",
"amount": 0,
"charges": 0,
"paidAmount": 0,
"countryCode": "KW",
"currencyCode": "KWD",
"paymentChannelCode": "",
"tunnel": "",
"authCode": "xxxx",
"transactionID": "xxxxx",
"refID": "xxxx",
"paymentID": "xxxx",
"result": "CAPTURED",
"status": 1,
"merchantRef": null,
"transactionDate": "2024-06-23T09:50:46.162Z",
"processedDate": "2024-06-23T09:53:06.576Z",
"mobile": "0",
"email": "string",
"response": "",
"info1": "",
"info2": "string",
"info3": "string",
"settlementDate": "",
"settledDate": "",
"settledBy": "string,
"isRefunded": 0 ,
"refundAmount": 0,
"refundedOn": 0,
"refundRefrence": 0,
"commissionAmnt": 0,
"serviceAmount": 0,
"merchantName": "string,
"originalAmount": 0,
"commissionDetails": "string,
"vat": 0,
"vatAmount": 0,
"finalCommission": 0
}
}
Response Parameters
Parameters
Datatype
Description
RefrenceId
String
15-digit unique transaction number
Amount
decimal
Amount of transaction
tranDate
Datetime
date of the transaction
result
string
show the result of the transaction (CANCELED or COMPLETED)
isRefunded
integer
1 is refunded 2 is processing 3 is rejected
Sample Code to post data
public async Task> CheckPaymentStatus(PaymentStatus obj)
{
Output dto = new Output();
var url = {Provided End Point};
var client = new HttpClient();
client.BaseAddress = new Uri(url);
try
{
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;
}
Class SurroundingClass
Public Task As async
Private Sub New(ByVal obj As PaymentStatus )
Dim dto As Output = New Output()
Dim url = {Provided End Point};
Dim client = New HttpClient()
client.BaseAddress = New Uri(url)
Try
Dim 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")
Dim response = client.PostAsJsonAsync(url, obj).Result
If response.IsSuccessStatusCode Then
Dim ss = response.Content.ReadAsStringAsync()
Dim result = JsonConvert.DeserializeObject > (ss.Result)
dto = result
Else
Dim ss = response.Content.ReadAsStringAsync()
Dim resps = ss.Result
Dim resultse = JsonConvert.SerializeObject(resps.ToString())
End If
Catch ex As HttpRequestException
End Try
Return dto
End Sub
End Class
<?php
// referenceID must be 15 digit Payment Number
$referenceID = 123456412250000;
$authKey = 'Your Authorization Key';
$merchantID = 'Your Merchent Key';
$data = array(
'merchantCode' => $merchantID,
'authKey' => $authKey,
'referenceID' => $referenceID,
);
$request = json_encode( $data, true );
if ( !$endpoint ) {
$curl = curl_init( 'https://ogcheckoutstage.oneglobal.com/OgPay/V1/api/GenToken/GetStatus' );
} else {
$curl = curl_init( $endpoint );
}
curl_setopt( $curl, CURLOPT_POST, true );
curl_setopt( $curl, CURLOPT_POSTFIELDS, $request );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Content-Type:application/json' ) );
$ch = curl_exec( $curl );
curl_close( $curl );
$response = json_decode( $ch, true );
?>
pagecode:` public async Task> PaymentStatus(PaymentStatus obj)
{
Output dto = new Output();
var url = {Provided End Point};
var client = new HttpClient();
client.BaseAddress = new Uri(url);
try
{
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;
var resultse = JsonConvert.SerializeObject(resps.ToString());
}
}
catch (HttpRequestException ex)
{
}
return dto;
}`;
Last updated