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
(Unicode 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 <CkHttpW.h> #include <CkJsonObjectW.h> void ChilkatSample(void) { // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttpW http; bool success; http.put_BasicAuth(true); http.put_Login(L"API_USERNAME"); http.put_Password(L"API_PASSWORD"); const wchar_t *url = L"https://<site>.cardconnect.com:<port>/cardconnect/rest/funding?merchid=<merchid>&date=<MMDD>"; const wchar_t *responseStr = http.quickGetStr(url); if (http.get_LastMethodSuccess() == false) { wprintf(L"%s\n",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. wprintf(L"response status code = %d\n",http.get_LastStatus()); CkJsonObjectW jsonResp; jsonResp.Load(responseStr); jsonResp.put_EmitCompact(false); wprintf(L"response JSON:\n"); wprintf(L"%s\n",jsonResp.emit()); // 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 int fundingmasterid; const wchar_t *fundingdate = 0; const wchar_t *datechanged = 0; const wchar_t *merchid = 0; int i; int count_i; const wchar_t *amount = 0; int fundingadjustmentid; const wchar_t *description = 0; const wchar_t *currency = 0; const wchar_t *category = 0; const wchar_t *v_type = 0; const wchar_t *dateadded = 0; int fundingid; const wchar_t *netsales = 0; const wchar_t *totalfunding = 0; const wchar_t *fee = 0; const wchar_t *deposittrancode = 0; const wchar_t *ddanumber = 0; const wchar_t *thirdparty = 0; const wchar_t *reversal = 0; const wchar_t *interchangefee = 0; const wchar_t *adjustment = 0; const wchar_t *depositachtracenumber = 0; const wchar_t *servicecharge = 0; const wchar_t *otheradjustment = 0; const wchar_t *abanumber = 0; const wchar_t *date = 0; const wchar_t *downgradereasoncodes = 0; const wchar_t *cardproc = 0; const wchar_t *sourcetransactionid = 0; int batchid; const wchar_t *respcode = 0; const wchar_t *interchangeunitfee = 0; const wchar_t *authcode = 0; const wchar_t *plancode = 0; int authdate; int fundingtxnid; const wchar_t *cardbrand = 0; const wchar_t *terminalnumber = 0; const wchar_t *cardnumber = 0; const wchar_t *cardtype = 0; const wchar_t *retref = 0; const wchar_t *status = 0; const wchar_t *interchangepercentfee = 0; const wchar_t *invoicenumber = 0; fundingmasterid = jsonResp.IntOf(L"fundingmasterid"); fundingdate = jsonResp.stringOf(L"fundingdate"); datechanged = jsonResp.stringOf(L"datechanged"); merchid = jsonResp.stringOf(L"merchid"); i = 0; count_i = jsonResp.SizeOfArray(L"adjustments"); while (i < count_i) { jsonResp.put_I(i); fundingmasterid = jsonResp.IntOf(L"adjustments[i].fundingmasterid"); amount = jsonResp.stringOf(L"adjustments[i].amount"); datechanged = jsonResp.stringOf(L"adjustments[i].datechanged"); fundingadjustmentid = jsonResp.IntOf(L"adjustments[i].fundingadjustmentid"); description = jsonResp.stringOf(L"adjustments[i].description"); currency = jsonResp.stringOf(L"adjustments[i].currency"); category = jsonResp.stringOf(L"adjustments[i].category"); v_type = jsonResp.stringOf(L"adjustments[i].type"); dateadded = jsonResp.stringOf(L"adjustments[i].dateadded"); merchid = jsonResp.stringOf(L"adjustments[i].merchid"); i = i + 1; } i = 0; count_i = jsonResp.SizeOfArray(L"fundings"); while (i < count_i) { jsonResp.put_I(i); fundingid = jsonResp.IntOf(L"fundings[i].fundingid"); netsales = jsonResp.stringOf(L"fundings[i].netsales"); totalfunding = jsonResp.stringOf(L"fundings[i].totalfunding"); fee = jsonResp.stringOf(L"fundings[i].fee"); datechanged = jsonResp.stringOf(L"fundings[i].datechanged"); deposittrancode = jsonResp.stringOf(L"fundings[i].deposittrancode"); ddanumber = jsonResp.stringOf(L"fundings[i].ddanumber"); thirdparty = jsonResp.stringOf(L"fundings[i].thirdparty"); dateadded = jsonResp.stringOf(L"fundings[i].dateadded"); fundingmasterid = jsonResp.IntOf(L"fundings[i].fundingmasterid"); reversal = jsonResp.stringOf(L"fundings[i].reversal"); interchangefee = jsonResp.stringOf(L"fundings[i].interchangefee"); adjustment = jsonResp.stringOf(L"fundings[i].adjustment"); currency = jsonResp.stringOf(L"fundings[i].currency"); depositachtracenumber = jsonResp.stringOf(L"fundings[i].depositachtracenumber"); servicecharge = jsonResp.stringOf(L"fundings[i].servicecharge"); otheradjustment = jsonResp.stringOf(L"fundings[i].otheradjustment"); abanumber = jsonResp.stringOf(L"fundings[i].abanumber"); i = i + 1; } i = 0; count_i = jsonResp.SizeOfArray(L"txns"); while (i < count_i) { jsonResp.put_I(i); date = jsonResp.stringOf(L"txns[i].date"); amount = jsonResp.stringOf(L"txns[i].amount"); downgradereasoncodes = jsonResp.stringOf(L"txns[i].downgradereasoncodes"); fundingid = jsonResp.IntOf(L"txns[i].fundingid"); cardproc = jsonResp.stringOf(L"txns[i].cardproc"); sourcetransactionid = jsonResp.stringOf(L"txns[i].sourcetransactionid"); v_type = jsonResp.stringOf(L"txns[i].type"); batchid = jsonResp.IntOf(L"txns[i].batchid"); respcode = jsonResp.stringOf(L"txns[i].respcode"); interchangeunitfee = jsonResp.stringOf(L"txns[i].interchangeunitfee"); authcode = jsonResp.stringOf(L"txns[i].authcode"); plancode = jsonResp.stringOf(L"txns[i].plancode"); authdate = jsonResp.IntOf(L"txns[i].authdate"); fundingtxnid = jsonResp.IntOf(L"txns[i].fundingtxnid"); cardbrand = jsonResp.stringOf(L"txns[i].cardbrand"); currency = jsonResp.stringOf(L"txns[i].currency"); terminalnumber = jsonResp.stringOf(L"txns[i].terminalnumber"); cardnumber = jsonResp.stringOf(L"txns[i].cardnumber"); cardtype = jsonResp.stringOf(L"txns[i].cardtype"); retref = jsonResp.stringOf(L"txns[i].retref"); status = jsonResp.stringOf(L"txns[i].status"); interchangepercentfee = jsonResp.stringOf(L"txns[i].interchangepercentfee"); invoicenumber = jsonResp.stringOf(L"txns[i].invoicenumber"); i = i + 1; } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.