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 <C_CkHttpW.h> #include <C_CkJsonObjectW.h> void ChilkatSample(void) { HCkHttpW http; BOOL success; const wchar_t *url; const wchar_t *responseStr; HCkJsonObjectW jsonResp; int fundingmasterid; const wchar_t *fundingdate; const wchar_t *datechanged; const wchar_t *merchid; int i; int count_i; const wchar_t *amount; int fundingadjustmentid; const wchar_t *description; const wchar_t *currency; const wchar_t *category; const wchar_t *v_type; const wchar_t *dateadded; int fundingid; const wchar_t *netsales; const wchar_t *totalfunding; const wchar_t *fee; const wchar_t *deposittrancode; const wchar_t *ddanumber; const wchar_t *thirdparty; const wchar_t *reversal; const wchar_t *interchangefee; const wchar_t *adjustment; const wchar_t *depositachtracenumber; const wchar_t *servicecharge; const wchar_t *otheradjustment; const wchar_t *abanumber; const wchar_t *date; const wchar_t *downgradereasoncodes; const wchar_t *cardproc; const wchar_t *sourcetransactionid; int batchid; const wchar_t *respcode; const wchar_t *interchangeunitfee; const wchar_t *authcode; const wchar_t *plancode; int authdate; int fundingtxnid; const wchar_t *cardbrand; const wchar_t *terminalnumber; const wchar_t *cardnumber; const wchar_t *cardtype; const wchar_t *retref; const wchar_t *status; const wchar_t *interchangepercentfee; const wchar_t *invoicenumber; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttpW_Create(); CkHttpW_putBasicAuth(http,TRUE); CkHttpW_putLogin(http,L"API_USERNAME"); CkHttpW_putPassword(http,L"API_PASSWORD"); url = L"https://<site>.cardconnect.com:<port>/cardconnect/rest/funding?merchid=<merchid>&date=<MMDD>"; responseStr = CkHttpW_quickGetStr(http,url); if (CkHttpW_getLastMethodSuccess(http) == FALSE) { wprintf(L"%s\n",CkHttpW_lastErrorText(http)); CkHttpW_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. wprintf(L"response status code = %d\n",CkHttpW_getLastStatus(http)); jsonResp = CkJsonObjectW_Create(); CkJsonObjectW_Load(jsonResp,responseStr); CkJsonObjectW_putEmitCompact(jsonResp,FALSE); wprintf(L"response JSON:\n"); wprintf(L"%s\n",CkJsonObjectW_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 = CkJsonObjectW_IntOf(jsonResp,L"fundingmasterid"); fundingdate = CkJsonObjectW_stringOf(jsonResp,L"fundingdate"); datechanged = CkJsonObjectW_stringOf(jsonResp,L"datechanged"); merchid = CkJsonObjectW_stringOf(jsonResp,L"merchid"); i = 0; count_i = CkJsonObjectW_SizeOfArray(jsonResp,L"adjustments"); while (i < count_i) { CkJsonObjectW_putI(jsonResp,i); fundingmasterid = CkJsonObjectW_IntOf(jsonResp,L"adjustments[i].fundingmasterid"); amount = CkJsonObjectW_stringOf(jsonResp,L"adjustments[i].amount"); datechanged = CkJsonObjectW_stringOf(jsonResp,L"adjustments[i].datechanged"); fundingadjustmentid = CkJsonObjectW_IntOf(jsonResp,L"adjustments[i].fundingadjustmentid"); description = CkJsonObjectW_stringOf(jsonResp,L"adjustments[i].description"); currency = CkJsonObjectW_stringOf(jsonResp,L"adjustments[i].currency"); category = CkJsonObjectW_stringOf(jsonResp,L"adjustments[i].category"); v_type = CkJsonObjectW_stringOf(jsonResp,L"adjustments[i].type"); dateadded = CkJsonObjectW_stringOf(jsonResp,L"adjustments[i].dateadded"); merchid = CkJsonObjectW_stringOf(jsonResp,L"adjustments[i].merchid"); i = i + 1; } i = 0; count_i = CkJsonObjectW_SizeOfArray(jsonResp,L"fundings"); while (i < count_i) { CkJsonObjectW_putI(jsonResp,i); fundingid = CkJsonObjectW_IntOf(jsonResp,L"fundings[i].fundingid"); netsales = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].netsales"); totalfunding = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].totalfunding"); fee = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].fee"); datechanged = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].datechanged"); deposittrancode = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].deposittrancode"); ddanumber = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].ddanumber"); thirdparty = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].thirdparty"); dateadded = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].dateadded"); fundingmasterid = CkJsonObjectW_IntOf(jsonResp,L"fundings[i].fundingmasterid"); reversal = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].reversal"); interchangefee = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].interchangefee"); adjustment = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].adjustment"); currency = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].currency"); depositachtracenumber = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].depositachtracenumber"); servicecharge = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].servicecharge"); otheradjustment = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].otheradjustment"); abanumber = CkJsonObjectW_stringOf(jsonResp,L"fundings[i].abanumber"); i = i + 1; } i = 0; count_i = CkJsonObjectW_SizeOfArray(jsonResp,L"txns"); while (i < count_i) { CkJsonObjectW_putI(jsonResp,i); date = CkJsonObjectW_stringOf(jsonResp,L"txns[i].date"); amount = CkJsonObjectW_stringOf(jsonResp,L"txns[i].amount"); downgradereasoncodes = CkJsonObjectW_stringOf(jsonResp,L"txns[i].downgradereasoncodes"); fundingid = CkJsonObjectW_IntOf(jsonResp,L"txns[i].fundingid"); cardproc = CkJsonObjectW_stringOf(jsonResp,L"txns[i].cardproc"); sourcetransactionid = CkJsonObjectW_stringOf(jsonResp,L"txns[i].sourcetransactionid"); v_type = CkJsonObjectW_stringOf(jsonResp,L"txns[i].type"); batchid = CkJsonObjectW_IntOf(jsonResp,L"txns[i].batchid"); respcode = CkJsonObjectW_stringOf(jsonResp,L"txns[i].respcode"); interchangeunitfee = CkJsonObjectW_stringOf(jsonResp,L"txns[i].interchangeunitfee"); authcode = CkJsonObjectW_stringOf(jsonResp,L"txns[i].authcode"); plancode = CkJsonObjectW_stringOf(jsonResp,L"txns[i].plancode"); authdate = CkJsonObjectW_IntOf(jsonResp,L"txns[i].authdate"); fundingtxnid = CkJsonObjectW_IntOf(jsonResp,L"txns[i].fundingtxnid"); cardbrand = CkJsonObjectW_stringOf(jsonResp,L"txns[i].cardbrand"); currency = CkJsonObjectW_stringOf(jsonResp,L"txns[i].currency"); terminalnumber = CkJsonObjectW_stringOf(jsonResp,L"txns[i].terminalnumber"); cardnumber = CkJsonObjectW_stringOf(jsonResp,L"txns[i].cardnumber"); cardtype = CkJsonObjectW_stringOf(jsonResp,L"txns[i].cardtype"); retref = CkJsonObjectW_stringOf(jsonResp,L"txns[i].retref"); status = CkJsonObjectW_stringOf(jsonResp,L"txns[i].status"); interchangepercentfee = CkJsonObjectW_stringOf(jsonResp,L"txns[i].interchangepercentfee"); invoicenumber = CkJsonObjectW_stringOf(jsonResp,L"txns[i].invoicenumber"); i = i + 1; } CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonResp); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.