Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(C#) CardConnect InquireDemonstrates 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
// This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Chilkat.Http http = new Chilkat.Http(); bool success; 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"); |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.