.NET Core C#
.NET Core C#
CardConnect Inquire
See more CardConnect Examples
Demonstrates how to get information for an individual transaction, including its settlement status (setlstat) and the response codes from the initial authorization.See https://developer.cardconnect.com/cardconnect-api?lang=json#inquire
Chilkat .NET Core C# Downloads
bool success = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Chilkat.Http http = new Chilkat.Http();
http.BasicAuth = true;
http.Login = "API_USERNAME";
http.Password = "API_PASSWORD";
string url = "https://<site>.cardconnect.com:<port>/cardconnect/rest/inquire/<retref>/<merchid>";
string responseStr = http.QuickGetStr(url);
if (http.LastMethodSuccess == false) {
Debug.WriteLine(http.LastErrorText);
return;
}
// A response status of 200 indicates potential success. The JSON response body
// must be examined to determine if it was truly successful or an error.
Debug.WriteLine("response status code = " + Convert.ToString(http.LastStatus));
Chilkat.JsonObject jsonResp = new Chilkat.JsonObject();
jsonResp.Load(responseStr);
jsonResp.EmitCompact = false;
Debug.WriteLine("response JSON:");
Debug.WriteLine(jsonResp.Emit());
// A successful response looks like this:
// {
// "amount": "0.00",
// "resptext": "Approval",
// "setlstat": "Voided",
// "capturedate": "20190422180044",
// "acctid": "1",
// "respcode": "00",
// "entrymode": "ECommerce",
// "merchid": "MERCHANT_ID",
// "token": "9418594164541111",
// "authcode": "PPS158",
// "respproc": "FNOR",
// "authdate": "20190422",
// "bintype": "",
// "profileid": "16618402968441604028",
// "lastfour": "1111",
// "name": "TOM JONES",
// "currency": "USD",
// "retref": "112989260941",
// "respstat": "A",
// "account": "9418594164541111"
// }
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
string amount = jsonResp.StringOf("amount");
string resptext = jsonResp.StringOf("resptext");
string setlstat = jsonResp.StringOf("setlstat");
string capturedate = jsonResp.StringOf("capturedate");
string acctid = jsonResp.StringOf("acctid");
string respcode = jsonResp.StringOf("respcode");
string entrymode = jsonResp.StringOf("entrymode");
string merchid = jsonResp.StringOf("merchid");
string token = jsonResp.StringOf("token");
string authcode = jsonResp.StringOf("authcode");
string respproc = jsonResp.StringOf("respproc");
string authdate = jsonResp.StringOf("authdate");
string bintype = jsonResp.StringOf("bintype");
string profileid = jsonResp.StringOf("profileid");
string lastfour = jsonResp.StringOf("lastfour");
string name = jsonResp.StringOf("name");
string currency = jsonResp.StringOf("currency");
string retref = jsonResp.StringOf("retref");
string respstat = jsonResp.StringOf("respstat");
string account = jsonResp.StringOf("account");