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
(Tcl) 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
load ./chilkat.dll # This example assumes the Chilkat API to have been previously unlocked. # See Global Unlock Sample for sample code. set http [new_CkHttp] CkHttp_put_BasicAuth $http 1 CkHttp_put_Login $http "API_USERNAME" CkHttp_put_Password $http "API_PASSWORD" set url "https://<site>.cardconnect.com:<port>/cardconnect/rest/funding?merchid=<merchid>&date=<MMDD>" set responseStr [CkHttp_quickGetStr $http $url] if {[CkHttp_get_LastMethodSuccess $http] == 0} then { puts [CkHttp_lastErrorText $http] delete_CkHttp $http exit } # 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. puts "response status code = [CkHttp_get_LastStatus $http]" set jsonResp [new_CkJsonObject] CkJsonObject_Load $jsonResp $responseStr CkJsonObject_put_EmitCompact $jsonResp 0 puts "response JSON:" puts [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 set fundingmasterid [CkJsonObject_IntOf $jsonResp "fundingmasterid"] set fundingdate [CkJsonObject_stringOf $jsonResp "fundingdate"] set datechanged [CkJsonObject_stringOf $jsonResp "datechanged"] set merchid [CkJsonObject_stringOf $jsonResp "merchid"] set i 0 set count_i [CkJsonObject_SizeOfArray $jsonResp "adjustments"] while {$i < $count_i} { CkJsonObject_put_I $jsonResp $i set fundingmasterid [CkJsonObject_IntOf $jsonResp "adjustments[i].fundingmasterid"] set amount [CkJsonObject_stringOf $jsonResp "adjustments[i].amount"] set datechanged [CkJsonObject_stringOf $jsonResp "adjustments[i].datechanged"] set fundingadjustmentid [CkJsonObject_IntOf $jsonResp "adjustments[i].fundingadjustmentid"] set description [CkJsonObject_stringOf $jsonResp "adjustments[i].description"] set currency [CkJsonObject_stringOf $jsonResp "adjustments[i].currency"] set category [CkJsonObject_stringOf $jsonResp "adjustments[i].category"] set v_type [CkJsonObject_stringOf $jsonResp "adjustments[i].type"] set dateadded [CkJsonObject_stringOf $jsonResp "adjustments[i].dateadded"] set merchid [CkJsonObject_stringOf $jsonResp "adjustments[i].merchid"] set i [expr $i + 1] } set i 0 set count_i [CkJsonObject_SizeOfArray $jsonResp "fundings"] while {$i < $count_i} { CkJsonObject_put_I $jsonResp $i set fundingid [CkJsonObject_IntOf $jsonResp "fundings[i].fundingid"] set netsales [CkJsonObject_stringOf $jsonResp "fundings[i].netsales"] set totalfunding [CkJsonObject_stringOf $jsonResp "fundings[i].totalfunding"] set fee [CkJsonObject_stringOf $jsonResp "fundings[i].fee"] set datechanged [CkJsonObject_stringOf $jsonResp "fundings[i].datechanged"] set deposittrancode [CkJsonObject_stringOf $jsonResp "fundings[i].deposittrancode"] set ddanumber [CkJsonObject_stringOf $jsonResp "fundings[i].ddanumber"] set thirdparty [CkJsonObject_stringOf $jsonResp "fundings[i].thirdparty"] set dateadded [CkJsonObject_stringOf $jsonResp "fundings[i].dateadded"] set fundingmasterid [CkJsonObject_IntOf $jsonResp "fundings[i].fundingmasterid"] set reversal [CkJsonObject_stringOf $jsonResp "fundings[i].reversal"] set interchangefee [CkJsonObject_stringOf $jsonResp "fundings[i].interchangefee"] set adjustment [CkJsonObject_stringOf $jsonResp "fundings[i].adjustment"] set currency [CkJsonObject_stringOf $jsonResp "fundings[i].currency"] set depositachtracenumber [CkJsonObject_stringOf $jsonResp "fundings[i].depositachtracenumber"] set servicecharge [CkJsonObject_stringOf $jsonResp "fundings[i].servicecharge"] set otheradjustment [CkJsonObject_stringOf $jsonResp "fundings[i].otheradjustment"] set abanumber [CkJsonObject_stringOf $jsonResp "fundings[i].abanumber"] set i [expr $i + 1] } set i 0 set count_i [CkJsonObject_SizeOfArray $jsonResp "txns"] while {$i < $count_i} { CkJsonObject_put_I $jsonResp $i set date [CkJsonObject_stringOf $jsonResp "txns[i].date"] set amount [CkJsonObject_stringOf $jsonResp "txns[i].amount"] set downgradereasoncodes [CkJsonObject_stringOf $jsonResp "txns[i].downgradereasoncodes"] set fundingid [CkJsonObject_IntOf $jsonResp "txns[i].fundingid"] set cardproc [CkJsonObject_stringOf $jsonResp "txns[i].cardproc"] set sourcetransactionid [CkJsonObject_stringOf $jsonResp "txns[i].sourcetransactionid"] set v_type [CkJsonObject_stringOf $jsonResp "txns[i].type"] set batchid [CkJsonObject_IntOf $jsonResp "txns[i].batchid"] set respcode [CkJsonObject_stringOf $jsonResp "txns[i].respcode"] set interchangeunitfee [CkJsonObject_stringOf $jsonResp "txns[i].interchangeunitfee"] set authcode [CkJsonObject_stringOf $jsonResp "txns[i].authcode"] set plancode [CkJsonObject_stringOf $jsonResp "txns[i].plancode"] set authdate [CkJsonObject_IntOf $jsonResp "txns[i].authdate"] set fundingtxnid [CkJsonObject_IntOf $jsonResp "txns[i].fundingtxnid"] set cardbrand [CkJsonObject_stringOf $jsonResp "txns[i].cardbrand"] set currency [CkJsonObject_stringOf $jsonResp "txns[i].currency"] set terminalnumber [CkJsonObject_stringOf $jsonResp "txns[i].terminalnumber"] set cardnumber [CkJsonObject_stringOf $jsonResp "txns[i].cardnumber"] set cardtype [CkJsonObject_stringOf $jsonResp "txns[i].cardtype"] set retref [CkJsonObject_stringOf $jsonResp "txns[i].retref"] set status [CkJsonObject_stringOf $jsonResp "txns[i].status"] set interchangepercentfee [CkJsonObject_stringOf $jsonResp "txns[i].interchangepercentfee"] set invoicenumber [CkJsonObject_stringOf $jsonResp "txns[i].invoicenumber"] set i [expr $i + 1] } delete_CkHttp $http delete_CkJsonObject $jsonResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.