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 FundingDemonstrates how to get the merchant funding information. The funding endpoint provides merchant funding information supported by supplemental transaction and funding adjustment detail. This information is provided by the host payment processing platform (for example, First Data Omaha). ... See https://developer.cardconnect.com/cardconnect-api?lang=json#funding
#include <C_CkHttp.h> #include <C_CkJsonObject.h> void ChilkatSample(void) { HCkHttp http; BOOL success; const char *url; const char *responseStr; HCkJsonObject jsonResp; int fundingmasterid; const char *fundingdate; const char *datechanged; const char *merchid; int i; int count_i; const char *amount; int fundingadjustmentid; const char *description; const char *currency; const char *category; const char *v_type; const char *dateadded; int fundingid; const char *netsales; const char *totalfunding; const char *fee; const char *deposittrancode; const char *ddanumber; const char *thirdparty; const char *reversal; const char *interchangefee; const char *adjustment; const char *depositachtracenumber; const char *servicecharge; const char *otheradjustment; const char *abanumber; const char *date; const char *downgradereasoncodes; const char *cardproc; const char *sourcetransactionid; int batchid; const char *respcode; const char *interchangeunitfee; const char *authcode; const char *plancode; int authdate; int fundingtxnid; const char *cardbrand; const char *terminalnumber; const char *cardnumber; const char *cardtype; const char *retref; const char *status; const char *interchangepercentfee; const char *invoicenumber; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttp_Create(); CkHttp_putBasicAuth(http,TRUE); CkHttp_putLogin(http,"API_USERNAME"); CkHttp_putPassword(http,"API_PASSWORD"); url = "https://<site>.cardconnect.com:<port>/cardconnect/rest/funding?merchid=<merchid>&date=<MMDD>"; responseStr = CkHttp_quickGetStr(http,url); if (CkHttp_getLastMethodSuccess(http) == FALSE) { printf("%s\n",CkHttp_lastErrorText(http)); CkHttp_Dispose(http); 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. printf("response status code = %d\n",CkHttp_getLastStatus(http)); jsonResp = CkJsonObject_Create(); CkJsonObject_Load(jsonResp,responseStr); CkJsonObject_putEmitCompact(jsonResp,FALSE); printf("response JSON:\n"); printf("%s\n",CkJsonObject_emit(jsonResp)); // A successful response looks like this: // ------ // See the parsing code below... // ------ // { // "fundingmasterid": 1121753252164835, // "fundingdate": "2019-04-22", // "adjustments": [ // { // "fundingmasterid": 1121753252164835, // "amount": "-44.98", // "datechanged": "2019-04-22", // "fundingadjustmentid": 1121754400164838, // "description": "THE CARDHOLDER DID NOT AUTHORIZE THE CHARGE.", // "currency": "USD", // "category": "REVERSAL", // "type": "CHARGEBACKS/CHARGEBACK REVERSALS", // "dateadded": "2019-04-22", // "merchid": "MERCHANT_ID" // }, // { // "fundingmasterid": 1121753252164835, // "amount": "-32.96", // "datechanged": "2019-04-22", // "fundingadjustmentid": 1121754401164838, // "description": "THIRD PARTY ADJUSTMENTS", // "currency": "USD", // "category": "THIRD PARTY", // "type": "THIRD PARTY ADJUSTMENTS", // "dateadded": "2019-04-22", // "merchid": "MERCHANT_ID" // } // ], // "datechanged": null, // "fundings": [ // { // "fundingid": 1121753284164836, // "netsales": "129453.03", // "totalfunding": "129375.09", // "fee": "0", // "datechanged": "2019-04-22", // "deposittrancode": null, // "ddanumber": "3300770540", // "thirdparty": "-32.96", // "dateadded": "2019-04-22", // "fundingmasterid": 1121753252164835, // "reversal": "-44.98", // "interchangefee": "0", // "adjustment": "0", // "currency": "USD", // "depositachtracenumber": null, // "servicecharge": "0", // "otheradjustment": "0", // "abanumber": "121140399" // } // ], // "merchid": "MERCHANT_ID", // "txns": [ // { // "date": "2019-04-19", // "amount": "76.75", // "downgradereasoncodes": null, // "fundingid": 1121753409164836, // "cardproc": "FNOR", // "sourcetransactionid": null, // "type": "SALE", // "batchid": 1900942289, // "respcode": "00", // "interchangeunitfee": "0", // "authcode": "PPS209", // "plancode": null, // "authdate": 20190419194808, // "fundingtxnid": 1121753252164835, // "cardbrand": "VISA", // "currency": "USD", // "terminalnumber": null, // "cardnumber": "42XXXXXXXXXX4242", // "cardtype": "Credit", // "retref": "109624271288", // "status": "Processed", // "interchangepercentfee": "0", // "invoicenumber": null // }, // { // "date": "2019-04-19", // "amount": "9.99", // "downgradereasoncodes": null, // "fundingid": 1121753410164836, // "cardproc": "FNOR", // "sourcetransactionid": null, // "type": "SALE", // "batchid": 1900942289, // "respcode": "00", // "interchangeunitfee": "0", // "authcode": "PPS009", // "plancode": null, // "authdate": 20190419201502, // "fundingtxnid": 1121753252164835, // "cardbrand": "VISA", // "currency": "USD", // "terminalnumber": null, // "cardnumber": "47XXXXXXXXXX1443", // "cardtype": "Credit", // "retref": "109638272902", // "status": "Processed", // "interchangepercentfee": "0", // "invoicenumber": null // } // ] // } // // Use this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON fundingmasterid = CkJsonObject_IntOf(jsonResp,"fundingmasterid"); fundingdate = CkJsonObject_stringOf(jsonResp,"fundingdate"); datechanged = CkJsonObject_stringOf(jsonResp,"datechanged"); merchid = CkJsonObject_stringOf(jsonResp,"merchid"); i = 0; count_i = CkJsonObject_SizeOfArray(jsonResp,"adjustments"); while (i < count_i) { CkJsonObject_putI(jsonResp,i); fundingmasterid = CkJsonObject_IntOf(jsonResp,"adjustments[i].fundingmasterid"); amount = CkJsonObject_stringOf(jsonResp,"adjustments[i].amount"); datechanged = CkJsonObject_stringOf(jsonResp,"adjustments[i].datechanged"); fundingadjustmentid = CkJsonObject_IntOf(jsonResp,"adjustments[i].fundingadjustmentid"); description = CkJsonObject_stringOf(jsonResp,"adjustments[i].description"); currency = CkJsonObject_stringOf(jsonResp,"adjustments[i].currency"); category = CkJsonObject_stringOf(jsonResp,"adjustments[i].category"); v_type = CkJsonObject_stringOf(jsonResp,"adjustments[i].type"); dateadded = CkJsonObject_stringOf(jsonResp,"adjustments[i].dateadded"); merchid = CkJsonObject_stringOf(jsonResp,"adjustments[i].merchid"); i = i + 1; } i = 0; count_i = CkJsonObject_SizeOfArray(jsonResp,"fundings"); while (i < count_i) { CkJsonObject_putI(jsonResp,i); fundingid = CkJsonObject_IntOf(jsonResp,"fundings[i].fundingid"); netsales = CkJsonObject_stringOf(jsonResp,"fundings[i].netsales"); totalfunding = CkJsonObject_stringOf(jsonResp,"fundings[i].totalfunding"); fee = CkJsonObject_stringOf(jsonResp,"fundings[i].fee"); datechanged = CkJsonObject_stringOf(jsonResp,"fundings[i].datechanged"); deposittrancode = CkJsonObject_stringOf(jsonResp,"fundings[i].deposittrancode"); ddanumber = CkJsonObject_stringOf(jsonResp,"fundings[i].ddanumber"); thirdparty = CkJsonObject_stringOf(jsonResp,"fundings[i].thirdparty"); dateadded = CkJsonObject_stringOf(jsonResp,"fundings[i].dateadded"); fundingmasterid = CkJsonObject_IntOf(jsonResp,"fundings[i].fundingmasterid"); reversal = CkJsonObject_stringOf(jsonResp,"fundings[i].reversal"); interchangefee = CkJsonObject_stringOf(jsonResp,"fundings[i].interchangefee"); adjustment = CkJsonObject_stringOf(jsonResp,"fundings[i].adjustment"); currency = CkJsonObject_stringOf(jsonResp,"fundings[i].currency"); depositachtracenumber = CkJsonObject_stringOf(jsonResp,"fundings[i].depositachtracenumber"); servicecharge = CkJsonObject_stringOf(jsonResp,"fundings[i].servicecharge"); otheradjustment = CkJsonObject_stringOf(jsonResp,"fundings[i].otheradjustment"); abanumber = CkJsonObject_stringOf(jsonResp,"fundings[i].abanumber"); i = i + 1; } i = 0; count_i = CkJsonObject_SizeOfArray(jsonResp,"txns"); while (i < count_i) { CkJsonObject_putI(jsonResp,i); date = CkJsonObject_stringOf(jsonResp,"txns[i].date"); amount = CkJsonObject_stringOf(jsonResp,"txns[i].amount"); downgradereasoncodes = CkJsonObject_stringOf(jsonResp,"txns[i].downgradereasoncodes"); fundingid = CkJsonObject_IntOf(jsonResp,"txns[i].fundingid"); cardproc = CkJsonObject_stringOf(jsonResp,"txns[i].cardproc"); sourcetransactionid = CkJsonObject_stringOf(jsonResp,"txns[i].sourcetransactionid"); v_type = CkJsonObject_stringOf(jsonResp,"txns[i].type"); batchid = CkJsonObject_IntOf(jsonResp,"txns[i].batchid"); respcode = CkJsonObject_stringOf(jsonResp,"txns[i].respcode"); interchangeunitfee = CkJsonObject_stringOf(jsonResp,"txns[i].interchangeunitfee"); authcode = CkJsonObject_stringOf(jsonResp,"txns[i].authcode"); plancode = CkJsonObject_stringOf(jsonResp,"txns[i].plancode"); authdate = CkJsonObject_IntOf(jsonResp,"txns[i].authdate"); fundingtxnid = CkJsonObject_IntOf(jsonResp,"txns[i].fundingtxnid"); cardbrand = CkJsonObject_stringOf(jsonResp,"txns[i].cardbrand"); currency = CkJsonObject_stringOf(jsonResp,"txns[i].currency"); terminalnumber = CkJsonObject_stringOf(jsonResp,"txns[i].terminalnumber"); cardnumber = CkJsonObject_stringOf(jsonResp,"txns[i].cardnumber"); cardtype = CkJsonObject_stringOf(jsonResp,"txns[i].cardtype"); retref = CkJsonObject_stringOf(jsonResp,"txns[i].retref"); status = CkJsonObject_stringOf(jsonResp,"txns[i].status"); interchangepercentfee = CkJsonObject_stringOf(jsonResp,"txns[i].interchangepercentfee"); invoicenumber = CkJsonObject_stringOf(jsonResp,"txns[i].invoicenumber"); i = i + 1; } CkHttp_Dispose(http); CkJsonObject_Dispose(jsonResp); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.