Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Swift 3/4 Web API Examples

Primary Categories

AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shippo
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
Xero
eBay
effectconnect

 

 

 

(Swift 3/4) CardConnect Funding

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 Downloads for the Swift Programming Language

MAC OS X (Cocoa) Objective-C/Swift Libs

iOS Objective-C/Swift Libs

func chilkatTest() {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()!
    var success: Bool

    http.basicAuth = true
    http.login = "API_USERNAME"
    http.password = "API_PASSWORD"

    var url: String? = "https://<site>.cardconnect.com:<port>/cardconnect/rest/funding?merchid=<merchid>&date=<MMDD>"
    var responseStr: String? = http.quickGetStr(url)
    if http.lastMethodSuccess == false {
        print("\(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.
    print("response status code = \(http.lastStatus.intValue)")

    let jsonResp = CkoJsonObject()!
    jsonResp.load(responseStr)
    jsonResp.emitCompact = false

    print("response JSON:")
    print("\(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

    var fundingmasterid: Int
    var fundingdate: String?
    var datechanged: String?
    var merchid: String?
    var i: Int
    var count_i: Int
    var amount: String?
    var fundingadjustmentid: Int
    var description: String?
    var currency: String?
    var category: String?
    var v_type: String?
    var dateadded: String?
    var fundingid: Int
    var netsales: String?
    var totalfunding: String?
    var fee: String?
    var deposittrancode: String?
    var ddanumber: String?
    var thirdparty: String?
    var reversal: String?
    var interchangefee: String?
    var adjustment: String?
    var depositachtracenumber: String?
    var servicecharge: String?
    var otheradjustment: String?
    var abanumber: String?
    var date: String?
    var downgradereasoncodes: String?
    var cardproc: String?
    var sourcetransactionid: String?
    var batchid: Int
    var respcode: String?
    var interchangeunitfee: String?
    var authcode: String?
    var plancode: String?
    var authdate: Int
    var fundingtxnid: Int
    var cardbrand: String?
    var terminalnumber: String?
    var cardnumber: String?
    var cardtype: String?
    var retref: String?
    var status: String?
    var interchangepercentfee: String?
    var invoicenumber: String?

    fundingmasterid = jsonResp.int(of: "fundingmasterid").intValue
    fundingdate = jsonResp.string(of: "fundingdate")
    datechanged = jsonResp.string(of: "datechanged")
    merchid = jsonResp.string(of: "merchid")
    i = 0
    count_i = jsonResp.size(ofArray: "adjustments").intValue
    while i < count_i {
        jsonResp.i = i
        fundingmasterid = jsonResp.int(of: "adjustments[i].fundingmasterid").intValue
        amount = jsonResp.string(of: "adjustments[i].amount")
        datechanged = jsonResp.string(of: "adjustments[i].datechanged")
        fundingadjustmentid = jsonResp.int(of: "adjustments[i].fundingadjustmentid").intValue
        description = jsonResp.string(of: "adjustments[i].description")
        currency = jsonResp.string(of: "adjustments[i].currency")
        category = jsonResp.string(of: "adjustments[i].category")
        v_type = jsonResp.string(of: "adjustments[i].type")
        dateadded = jsonResp.string(of: "adjustments[i].dateadded")
        merchid = jsonResp.string(of: "adjustments[i].merchid")
        i = i + 1
    }

    i = 0
    count_i = jsonResp.size(ofArray: "fundings").intValue
    while i < count_i {
        jsonResp.i = i
        fundingid = jsonResp.int(of: "fundings[i].fundingid").intValue
        netsales = jsonResp.string(of: "fundings[i].netsales")
        totalfunding = jsonResp.string(of: "fundings[i].totalfunding")
        fee = jsonResp.string(of: "fundings[i].fee")
        datechanged = jsonResp.string(of: "fundings[i].datechanged")
        deposittrancode = jsonResp.string(of: "fundings[i].deposittrancode")
        ddanumber = jsonResp.string(of: "fundings[i].ddanumber")
        thirdparty = jsonResp.string(of: "fundings[i].thirdparty")
        dateadded = jsonResp.string(of: "fundings[i].dateadded")
        fundingmasterid = jsonResp.int(of: "fundings[i].fundingmasterid").intValue
        reversal = jsonResp.string(of: "fundings[i].reversal")
        interchangefee = jsonResp.string(of: "fundings[i].interchangefee")
        adjustment = jsonResp.string(of: "fundings[i].adjustment")
        currency = jsonResp.string(of: "fundings[i].currency")
        depositachtracenumber = jsonResp.string(of: "fundings[i].depositachtracenumber")
        servicecharge = jsonResp.string(of: "fundings[i].servicecharge")
        otheradjustment = jsonResp.string(of: "fundings[i].otheradjustment")
        abanumber = jsonResp.string(of: "fundings[i].abanumber")
        i = i + 1
    }

    i = 0
    count_i = jsonResp.size(ofArray: "txns").intValue
    while i < count_i {
        jsonResp.i = i
        date = jsonResp.string(of: "txns[i].date")
        amount = jsonResp.string(of: "txns[i].amount")
        downgradereasoncodes = jsonResp.string(of: "txns[i].downgradereasoncodes")
        fundingid = jsonResp.int(of: "txns[i].fundingid").intValue
        cardproc = jsonResp.string(of: "txns[i].cardproc")
        sourcetransactionid = jsonResp.string(of: "txns[i].sourcetransactionid")
        v_type = jsonResp.string(of: "txns[i].type")
        batchid = jsonResp.int(of: "txns[i].batchid").intValue
        respcode = jsonResp.string(of: "txns[i].respcode")
        interchangeunitfee = jsonResp.string(of: "txns[i].interchangeunitfee")
        authcode = jsonResp.string(of: "txns[i].authcode")
        plancode = jsonResp.string(of: "txns[i].plancode")
        authdate = jsonResp.int(of: "txns[i].authdate").intValue
        fundingtxnid = jsonResp.int(of: "txns[i].fundingtxnid").intValue
        cardbrand = jsonResp.string(of: "txns[i].cardbrand")
        currency = jsonResp.string(of: "txns[i].currency")
        terminalnumber = jsonResp.string(of: "txns[i].terminalnumber")
        cardnumber = jsonResp.string(of: "txns[i].cardnumber")
        cardtype = jsonResp.string(of: "txns[i].cardtype")
        retref = jsonResp.string(of: "txns[i].retref")
        status = jsonResp.string(of: "txns[i].status")
        interchangepercentfee = jsonResp.string(of: "txns[i].interchangepercentfee")
        invoicenumber = jsonResp.string(of: "txns[i].invoicenumber")
        i = i + 1
    }


}

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.