Chilkat Online Tools

Swift / CardPointe API Integration / Funding (Date=MMDD)

Back to Collection Items

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

    let queryParams = CkoJsonObject()
    queryParams.UpdateString("merchid", value: "{{merchid}}")
    queryParams.UpdateString("date", value: "{{date}}")

    http.SetRequestHeader("Authorization", value: "Basic dGVzdGluZzp0ZXN0aW5nMTIz")
    http.SetRequestHeader("Content-Type", value: "application/json")

    var resp: CkoHttpResponse? = http.QuickRequestParams("GET", url: "https://domain.com/funding", json: queryParams)
    if http.LastMethodSuccess == false {
        print("\(http.LastErrorText)")
        return
    }

    print("\(resp!.StatusCode.intValue)")
    print("\(resp!.BodyStr)")
    resp = nil

}

Curl Command

curl -G -d "merchid=%7B%7Bmerchid%7D%7D"
	-d "date=%7B%7Bdate%7D%7D"
	-H "Authorization: Basic dGVzdGluZzp0ZXN0aW5nMTIz"
	-H "Content-Type: application/json"
https://domain.com/funding

Postman Collection Item JSON

{
  "name": "Funding (Date=MMDD)",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Basic dGVzdGluZzp0ZXN0aW5nMTIz"
      },
      {
        "key": "Content-Type",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{url}}/funding?merchid={{merchid}}&date={{date}}",
      "host": [
        "{{url}}"
      ],
      "path": [
        "funding"
      ],
      "query": [
        {
          "key": "merchid",
          "value": "{{merchid}}"
        },
        {
          "key": "date",
          "value": "{{date}}"
        }
      ]
    }
  },
  "response": [
  ]
}