Sample code for 30+ languages & platforms
Delphi DLL

CardConnect Funding

See more CardConnect Examples

Demonstrates 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

Chilkat Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, JsonObject, Http;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
http: HCkHttp;
url: PWideChar;
responseStr: PWideChar;
jsonResp: HCkJsonObject;
fundingmasterid: Integer;
fundingdate: PWideChar;
datechanged: PWideChar;
merchid: PWideChar;
i: Integer;
count_i: Integer;
amount: PWideChar;
fundingadjustmentid: Integer;
description: PWideChar;
currency: PWideChar;
category: PWideChar;
v_type: PWideChar;
dateadded: PWideChar;
fundingid: Integer;
netsales: PWideChar;
totalfunding: PWideChar;
fee: PWideChar;
deposittrancode: PWideChar;
ddanumber: PWideChar;
thirdparty: PWideChar;
reversal: PWideChar;
interchangefee: PWideChar;
adjustment: PWideChar;
depositachtracenumber: PWideChar;
servicecharge: PWideChar;
otheradjustment: PWideChar;
abanumber: PWideChar;
date: PWideChar;
downgradereasoncodes: PWideChar;
cardproc: PWideChar;
sourcetransactionid: PWideChar;
batchid: Integer;
respcode: PWideChar;
interchangeunitfee: PWideChar;
authcode: PWideChar;
plancode: PWideChar;
authdate: Integer;
fundingtxnid: Integer;
cardbrand: PWideChar;
terminalnumber: PWideChar;
cardnumber: PWideChar;
cardtype: PWideChar;
retref: PWideChar;
status: PWideChar;
interchangepercentfee: PWideChar;
invoicenumber: PWideChar;

begin
success := False;

// 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) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

// 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.
Memo1.Lines.Add('response status code = ' + IntToStr(CkHttp_getLastStatus(http)));

jsonResp := CkJsonObject_Create();
CkJsonObject_Load(jsonResp,responseStr);
CkJsonObject_putEmitCompact(jsonResp,False);

Memo1.Lines.Add('response JSON:');
Memo1.Lines.Add(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 do
  begin
    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;
  end;

i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResp,'fundings');
while i < count_i do
  begin
    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;
  end;

i := 0;
count_i := CkJsonObject_SizeOfArray(jsonResp,'txns');
while i < count_i do
  begin
    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;
  end;

CkHttp_Dispose(http);
CkJsonObject_Dispose(jsonResp);

end;