Chilkat Online Tools

unicodeC / Broker API / CIP Info

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW json;
    HCkHttpResponseW resp;

    // 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_key}}");
    CkHttpW_putPassword(http,L"{{api_secret}}");

    // Use this online tool to generate code from sample JSON: Generate Code to Create JSON

    // The following JSON is sent in the request body.

    // {
    //   "provider_name": [
    //     "onfido"
    //   ],
    //   "kyc": {
    //     "id": "CBDAD1C4-1047-450E-BAE5-B6C406F509B4",
    //     "risk_level": "LOW",
    //     "applicant_name": "John Doe",
    //     "email_address": "johndoe@example.com",
    //     "nationality": "American",
    //     "id_number": "jd0000123456789",
    //     "date_of_birth": "1970-12-01",
    //     "address": "42 Faux St",
    //     "postal_code": "94401",
    //     "country_of_residency": "USA",
    //     "kyc_completed_at": "2021-06-10T15:37:03Z",
    //     "ip_address": "127.0.0.1",
    //     "check_initiated_at": "2021-06-10T15:37:03Z",
    //     "check_completed_at": "2021-06-10T15:37:03Z",
    //     "approval_status": "approved",
    //     "approved_by": "Jane Doe",
    //     "approved_at": "2021-06-10T15:38:03Z"
    //   },
    //   "document": {
    //     "id": "55B9931A-3BE6-4BC0-9BDD-0B954E4A4632",
    //     "result": "clear",
    //     "status": "complete",
    //     "created_at": "2021-06-10T15:37:03Z",
    //     "image_integrity": "clear"
    //   },
    //   "photo": {
    //     "id": "0DD13020-F0FD-4B5A-B58F-BC1885E90A6D",
    //     "result": "clear",
    //     "status": "complete",
    //     "created_at": "2021-06-10T15:37:03Z",
    //     "face_comparison": "clear"
    //   },
    //   "identity": {
    //     "id": "28E1CCE8-1B1A-4472-9AD4-C6C5B7C3A6AF",
    //     "result": "clear",
    //     "status": "complete",
    //     "created_at": "2021-06-10T15:37:03Z",
    //     "sources": "clear",
    //     "address": "clear",
    //     "date_of_birth": "clear"
    //   },
    //   "watchlist": {
    //     "id": "7572B870-EB4C-46A2-8B88-509194CCEE7E",
    //     "result": "clear",
    //     "status": "complete",
    //     "created_at": "2021-06-10T15:37:03Z",
    //     "politically_exposed_person": "clear",
    //     "sanction": "clear",
    //     "adverse_media": "clear",
    //     "monitored_lists": "clear"
    //   }
    // }

    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(json,L"provider_name[0]",L"onfido");
    CkJsonObjectW_UpdateString(json,L"kyc.id",L"CBDAD1C4-1047-450E-BAE5-B6C406F509B4");
    CkJsonObjectW_UpdateString(json,L"kyc.risk_level",L"LOW");
    CkJsonObjectW_UpdateString(json,L"kyc.applicant_name",L"John Doe");
    CkJsonObjectW_UpdateString(json,L"kyc.email_address",L"johndoe@example.com");
    CkJsonObjectW_UpdateString(json,L"kyc.nationality",L"American");
    CkJsonObjectW_UpdateString(json,L"kyc.id_number",L"jd0000123456789");
    CkJsonObjectW_UpdateString(json,L"kyc.date_of_birth",L"1970-12-01");
    CkJsonObjectW_UpdateString(json,L"kyc.address",L"42 Faux St");
    CkJsonObjectW_UpdateString(json,L"kyc.postal_code",L"94401");
    CkJsonObjectW_UpdateString(json,L"kyc.country_of_residency",L"USA");
    CkJsonObjectW_UpdateString(json,L"kyc.kyc_completed_at",L"2021-06-10T15:37:03Z");
    CkJsonObjectW_UpdateString(json,L"kyc.ip_address",L"127.0.0.1");
    CkJsonObjectW_UpdateString(json,L"kyc.check_initiated_at",L"2021-06-10T15:37:03Z");
    CkJsonObjectW_UpdateString(json,L"kyc.check_completed_at",L"2021-06-10T15:37:03Z");
    CkJsonObjectW_UpdateString(json,L"kyc.approval_status",L"approved");
    CkJsonObjectW_UpdateString(json,L"kyc.approved_by",L"Jane Doe");
    CkJsonObjectW_UpdateString(json,L"kyc.approved_at",L"2021-06-10T15:38:03Z");
    CkJsonObjectW_UpdateString(json,L"document.id",L"55B9931A-3BE6-4BC0-9BDD-0B954E4A4632");
    CkJsonObjectW_UpdateString(json,L"document.result",L"clear");
    CkJsonObjectW_UpdateString(json,L"document.status",L"complete");
    CkJsonObjectW_UpdateString(json,L"document.created_at",L"2021-06-10T15:37:03Z");
    CkJsonObjectW_UpdateString(json,L"document.image_integrity",L"clear");
    CkJsonObjectW_UpdateString(json,L"photo.id",L"0DD13020-F0FD-4B5A-B58F-BC1885E90A6D");
    CkJsonObjectW_UpdateString(json,L"photo.result",L"clear");
    CkJsonObjectW_UpdateString(json,L"photo.status",L"complete");
    CkJsonObjectW_UpdateString(json,L"photo.created_at",L"2021-06-10T15:37:03Z");
    CkJsonObjectW_UpdateString(json,L"photo.face_comparison",L"clear");
    CkJsonObjectW_UpdateString(json,L"identity.id",L"28E1CCE8-1B1A-4472-9AD4-C6C5B7C3A6AF");
    CkJsonObjectW_UpdateString(json,L"identity.result",L"clear");
    CkJsonObjectW_UpdateString(json,L"identity.status",L"complete");
    CkJsonObjectW_UpdateString(json,L"identity.created_at",L"2021-06-10T15:37:03Z");
    CkJsonObjectW_UpdateString(json,L"identity.sources",L"clear");
    CkJsonObjectW_UpdateString(json,L"identity.address",L"clear");
    CkJsonObjectW_UpdateString(json,L"identity.date_of_birth",L"clear");
    CkJsonObjectW_UpdateString(json,L"watchlist.id",L"7572B870-EB4C-46A2-8B88-509194CCEE7E");
    CkJsonObjectW_UpdateString(json,L"watchlist.result",L"clear");
    CkJsonObjectW_UpdateString(json,L"watchlist.status",L"complete");
    CkJsonObjectW_UpdateString(json,L"watchlist.created_at",L"2021-06-10T15:37:03Z");
    CkJsonObjectW_UpdateString(json,L"watchlist.politically_exposed_person",L"clear");
    CkJsonObjectW_UpdateString(json,L"watchlist.sanction",L"clear");
    CkJsonObjectW_UpdateString(json,L"watchlist.adverse_media",L"clear");
    CkJsonObjectW_UpdateString(json,L"watchlist.monitored_lists",L"clear");

    resp = CkHttpW_PostJson3(http,L"https://domain.com/v1/accounts/:account_id/cip",L"application/json",json);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        return;
    }

    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpResponseW_Dispose(resp);


    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(json);

    }

Curl Command

curl -X POST
	-u '{{api_key}}:{{api_secret}}'
	-d '{
  "provider_name": ["onfido"],
  "kyc": {
    "id": "CBDAD1C4-1047-450E-BAE5-B6C406F509B4",
    "risk_level": "LOW",
    "applicant_name": "John Doe",
    "email_address": "johndoe@example.com",
    "nationality": "American",
    "id_number": "jd0000123456789",
    "date_of_birth": "1970-12-01",
    "address": "42 Faux St",
    "postal_code": "94401",
    "country_of_residency": "USA",
    "kyc_completed_at": "2021-06-10T15:37:03Z",
    "ip_address": "127.0.0.1",
    "check_initiated_at": "2021-06-10T15:37:03Z",
    "check_completed_at": "2021-06-10T15:37:03Z",
    "approval_status": "approved",
    "approved_by": "Jane Doe",
    "approved_at": "2021-06-10T15:38:03Z"
  },
  "document": {
    "id": "55B9931A-3BE6-4BC0-9BDD-0B954E4A4632",
    "result": "clear",
    "status": "complete",
    "created_at": "2021-06-10T15:37:03Z",
    "image_integrity": "clear"
  },
  "photo": {
    "id": "0DD13020-F0FD-4B5A-B58F-BC1885E90A6D",
    "result": "clear",
    "status": "complete",
    "created_at": "2021-06-10T15:37:03Z",
    "face_comparison": "clear"
  },
  "identity": {
    "id": "28E1CCE8-1B1A-4472-9AD4-C6C5B7C3A6AF",
    "result": "clear",
    "status": "complete",
    "created_at": "2021-06-10T15:37:03Z",
    "sources": "clear",
    "address": "clear",
    "date_of_birth": "clear"
  },
  "watchlist": {
    "id": "7572B870-EB4C-46A2-8B88-509194CCEE7E",
    "result": "clear",
    "status": "complete",
    "created_at": "2021-06-10T15:37:03Z",
    "politically_exposed_person": "clear",
    "sanction": "clear",
    "adverse_media": "clear",
    "monitored_lists": "clear"
  }
}'
https://domain.com/v1/accounts/:account_id/cip

Postman Collection Item JSON

{
  "name": "CIP Info",
  "request": {
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"provider_name\": [\"onfido\"],\n  \"kyc\": {\n    \"id\": \"CBDAD1C4-1047-450E-BAE5-B6C406F509B4\",\n    \"risk_level\": \"LOW\",\n    \"applicant_name\": \"John Doe\",\n    \"email_address\": \"johndoe@example.com\",\n    \"nationality\": \"American\",\n    \"id_number\": \"jd0000123456789\",\n    \"date_of_birth\": \"1970-12-01\",\n    \"address\": \"42 Faux St\",\n    \"postal_code\": \"94401\",\n    \"country_of_residency\": \"USA\",\n    \"kyc_completed_at\": \"2021-06-10T15:37:03Z\",\n    \"ip_address\": \"127.0.0.1\",\n    \"check_initiated_at\": \"2021-06-10T15:37:03Z\",\n    \"check_completed_at\": \"2021-06-10T15:37:03Z\",\n    \"approval_status\": \"approved\",\n    \"approved_by\": \"Jane Doe\",\n    \"approved_at\": \"2021-06-10T15:38:03Z\"\n  },\n  \"document\": {\n    \"id\": \"55B9931A-3BE6-4BC0-9BDD-0B954E4A4632\",\n    \"result\": \"clear\",\n    \"status\": \"complete\",\n    \"created_at\": \"2021-06-10T15:37:03Z\",\n    \"image_integrity\": \"clear\"\n  },\n  \"photo\": {\n    \"id\": \"0DD13020-F0FD-4B5A-B58F-BC1885E90A6D\",\n    \"result\": \"clear\",\n    \"status\": \"complete\",\n    \"created_at\": \"2021-06-10T15:37:03Z\",\n    \"face_comparison\": \"clear\"\n  },\n  \"identity\": {\n    \"id\": \"28E1CCE8-1B1A-4472-9AD4-C6C5B7C3A6AF\",\n    \"result\": \"clear\",\n    \"status\": \"complete\",\n    \"created_at\": \"2021-06-10T15:37:03Z\",\n    \"sources\": \"clear\",\n    \"address\": \"clear\",\n    \"date_of_birth\": \"clear\"\n  },\n  \"watchlist\": {\n    \"id\": \"7572B870-EB4C-46A2-8B88-509194CCEE7E\",\n    \"result\": \"clear\",\n    \"status\": \"complete\",\n    \"created_at\": \"2021-06-10T15:37:03Z\",\n    \"politically_exposed_person\": \"clear\",\n    \"sanction\": \"clear\",\n    \"adverse_media\": \"clear\",\n    \"monitored_lists\": \"clear\"\n  }\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{HOST}}/v1/accounts/:account_id/cip",
      "host": [
        "{{HOST}}"
      ],
      "path": [
        "v1",
        "accounts",
        ":account_id",
        "cip"
      ],
      "variable": [
        {
          "key": "account_id",
          "value": null
        }
      ]
    },
    "description": "| Attribute      | Requirement     |\n| ---------------|:-------------:  |\n| `provider`     | Optional        |\n| `kyc`          | Optional        |\n| `document`     | Optional        |\n| `photo`        | Optional        |\n| `identity`     | Optional        |\n| `watchlist`    | Optional        |"
  },
  "response": [
  ]
}