Batch Log Query
URL Endpoint: https://easypay5.com/APIcardProcREST/v1.0.0/Query/BatchLog
Request Method: POST
Headers:
Session Key is passed to the API via the header:
Content-Type: application/json
Accept: application/json
SessKey: A1842D663E9A4A72XXXXXXXX303541303234373138
Copied
{
"Query": "(C>='7/19/2023')&&(C<'7/20/2023')"
}
{
"Batch_Log_QueryResult": {
"BatchLogs": [
{
"BatchAmt": 110.0000,
"BatchClose": "020224054035",
"BatchNO": 512,
"BatchOpen": "020224054031",
"BatchRecs": 3,
"Code": "A",
"CreatedBy": "AUTOSCHED",
"CreatedOn": "/Date(1706870429107-0500)/",
"FinishedOn": "/Date(1706870433557-0500)/",
"ID": 612,
"MerchID": 3,
"Released": 0,
"SettleResp": "APPROVAL Batch:512:Recs:3:$110.00",
"TxLOCK": "8892F00CC55349FD"
},
{
"BatchAmt": 2.0000,
"BatchClose": "020124054026",
"BatchNO": 510,
"BatchOpen": "020124054024",
"BatchRecs": 1,
"Code": "A",
"CreatedBy": "AUTOSCHED",
"CreatedOn": "/Date(1706784022493-0500)/",
"FinishedOn": "/Date(1706784024547-0500)/",
"ID": 610,
"MerchID": 3,
"Released": 0,
"SettleResp": "APPROVAL Batch:510:Recs:1:$2.00",
"TxLOCK": "85A16087F72B41FD"
},
{
"BatchAmt": 300.0000,
"BatchClose": "013024054047",
"BatchNO": 507,
"BatchOpen": "013024054044",
"BatchRecs": 1,
"Code": "A",
"CreatedBy": "AUTOSCHED",
"CreatedOn": "/Date(1706611244230-0500)/",
"FinishedOn": "/Date(1706611247130-0500)/",
"ID": 607,
"MerchID": 3,
"Released": 0,
"SettleResp": "APPROVAL Batch:507:Recs:1:$300.00",
"TxLOCK": "2BD0B75DE0BA496F"
},
{
"BatchAmt": 110.0000,
"BatchClose": "012624054036",
"BatchNO": 504,
"BatchOpen": "012624054031",
"BatchRecs": 3,
"Code": "A",
"CreatedBy": "AUTOSCHED",
"CreatedOn": "/Date(1706265627950-0500)/",
"FinishedOn": "/Date(1706265633330-0500)/",
"ID": 604,
"MerchID": 3,
"Released": 0,
"SettleResp": "APPROVAL Batch:504:Recs:3:$110.00",
"TxLOCK": "49C0CB905D7F41BE"
},
{
"BatchAmt": 2.0000,
"BatchClose": "012524054042",
"BatchNO": 501,
"BatchOpen": "012524054039",
"BatchRecs": 1,
"Code": "A",
"CreatedBy": "AUTOSCHED",
"CreatedOn": "/Date(1706179236843-0500)/",
"FinishedOn": "/Date(1706179239363-0500)/",
"ID": 601,
"MerchID": 3,
"Released": 0,
"SettleResp": "APPROVAL Batch:501:Recs:1:$2.00",
"TxLOCK": "6818E8AD5FC244EE"
},
{
"BatchAmt": 110.0000,
"BatchClose": "011924054056",
"BatchNO": 496,
"BatchOpen": "011924054052",
"BatchRecs": 3,
"Code": "A",
"CreatedBy": "AUTOSCHED",
"CreatedOn": "/Date(1705660847470-0500)/",
"FinishedOn": "/Date(1705660852417-0500)/",
"ID": 596,
"MerchID": 3,
"Released": 0,
"SettleResp": "APPROVAL Batch:496:Recs:3:$110.00",
"TxLOCK": "624D6BA88D404053"
},
{
"BatchAmt": 2.0000,
"BatchClose": "011824054014",
"BatchNO": 494,
"BatchOpen": "011824054012",
"BatchRecs": 1,
"Code": "A",
"CreatedBy": "AUTOSCHED",
"CreatedOn": "/Date(1705574408747-0500)/",
"FinishedOn": "/Date(1705574410760-0500)/",
"ID": 594,
"MerchID": 3,
"Released": 0,
"SettleResp": "APPROVAL Batch:494:Recs:1:$2.00",
"TxLOCK": "DA0D444E94BF4EDD"
},
{
"BatchAmt": 110.0000,
"BatchClose": "011224054043",
"BatchNO": 483,
"BatchOpen": "011224054038",
"BatchRecs": 3,
"Code": "A",
"CreatedBy": "AUTOSCHED",
"CreatedOn": "/Date(1705056038170-0500)/",
"FinishedOn": "/Date(1705056043033-0500)/",
"ID": 583,
"MerchID": 3,
"Released": 0,
"SettleResp": "APPROVAL Batch:483:Recs:3:$110.00",
"TxLOCK": "F38FFAEF08CC4784"
},
{
"BatchAmt": 19.0000,
"BatchClose": "011124054048",
"BatchNO": 481,
"BatchOpen": "011124054039",
"BatchRecs": 5,
"Code": "A",
"CreatedBy": "AUTOSCHED",
"CreatedOn": "/Date(1704969639820-0500)/",
"FinishedOn": "/Date(1704969648200-0500)/",
"ID": 581,
"MerchID": 3,
"Released": 0,
"SettleResp": "APPROVAL Batch:481:Recs:5:$19.00",
"TxLOCK": "926E9BBE7B82401F"
}
],
"ErrCode": 0,
"ErrMsg": "",
"FunctionOk": true,
"NumRecords": 9,
"RespMsg": "Successfully Returned Batch Log Records : 9"
}
}
Copied
private void BatchLogQuery() {
// Session Key gathered using the Authenticate Command.
string SessKey = "52B1F6B36F35400EA4303237343341303337353938";
// query batch logs for the past week
DateTime start = DateTime.Today.AddDays(-7);
DateTime end = DateTime.Today.AddDays(1);
string Query = "(C>='" + start.ToString() + "')&&(C<'" + end.ToString() + "')";
string json = JsonConvert.SerializeObject(new { Query });
byte[] data = Encoding.UTF8.GetBytes(json);
// create Request
WebRequest request = WebRequest.Create("https://easypay5.com/APIcardProcREST/v1.0.0/Query/BatchLog");
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = data.Length;
// use your session key obtained when you authenticated
request.Headers.Add("SessKey: " + SessKey);
string Myheaders = request.Headers.ToString();
string responseContent = null;
// Using the Try block will catch communication errors
try {
using (Stream stream = request.GetRequestStream()) {
stream.Write(data, 0, data.Length);
}
using (WebResponse response = request.GetResponse()) {
using (Stream stream = response.GetResponseStream()) {
using (StreamReader sr99 = new StreamReader(stream)) {
responseContent = sr99.ReadToEnd();
}
}
}
} catch (Exception ee) {
logError("Problem communicating with EasyPay Service:" + ee.Message);
return;
}
// Check for null Response as this would be a critical communication error as well
if (responseContent == null) {
logError("Critical Error!, null response");
return;
}
/// develop Response Object
var Result = JsonConvert.DeserializeObject<dynamic>(responseContent);
bool FunctionOk = (bool)Result.Batch_Log_QueryResult.FunctionOk;
int ErrCode = (int)Result.Batch_Log_QueryResult.ErrCode;
string ErrMsg = (string)Result.Batch_Log_QueryResult.ErrMsg;
string RespMsg = (string)Result.Batch_Log_QueryResult.RespMsg;
//Check for unexpected Errors on cloud servers. If errors found Stop Processing and check ErrorCodes
if (!FunctionOk) {
logError(RespMsg + " " + ErrCode + " " + ErrMsg);
return;
}
// retrieve batch log information
var logs = Result.Batch_Log_QueryResult.BatchLogs;
foreach (var log in logs) {
Response.Write(log.ToString() + "<br/>");
}
}
private static void logError(string msg) {
// implement your logging function here.
}