Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Unicode C++ Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Unicode C++) CardConnect Authorization

Demonstrates how to send an Authorization request.

Authorization is the initial step in accepting payment from a cardholder. This action "authorizes" or requests permission from the bank to transfer money from the cardholder to the merchant.

See https://developer.cardconnect.com/cardconnect-api#authorization

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Solaris C/C++

MinGW C/C++

#include <CkHttpW.h>
#include <CkJsonObjectW.h>

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

    CkHttpW http;
    bool success;

    http.put_BasicAuth(true);
    http.put_Login(L"API_USERNAME");
    http.put_Password(L"API_PASSWORD");

    // Build and send the following JSON:

    // Note: The CardConnect online documentation might use an expiry that is in the past, such as "1218".
    // This causes the request to fail.  Use a month/year that is in the future..
    // (Likewise, this example will have an invalid month/year after Dec 2021)

    // {
    //   "merchid": "MERCHANT_ID",
    //   "accttype": "VISA",
    //   "orderid": "AB-11-9876",
    //   "account": "4111111111111111",
    //   "expiry": "1221",
    //   "amount": "0",
    //   "currency": "USD",
    //   "name": "TOM JONES",
    //   "address": "123 MAIN STREET",
    //   "city": "anytown",
    //   "region": "NY",
    //   "country": "US",
    //   "postal": "55555",
    //   "profile": "Y",
    //   "ecomind": "E",
    //   "cvv2": "123",
    //   "track": null,
    //   "capture": "Y"
    // }

    // Use this online tool to generate the code from sample JSON: 
    // Generate Code to Create JSON
    CkJsonObjectW json;
    json.UpdateString(L"merchid",L"MERCHANT_ID");
    json.UpdateString(L"accttype",L"VISA");
    json.UpdateString(L"orderid",L"AB-11-9876");
    json.UpdateString(L"account",L"4111111111111111");
    json.UpdateString(L"expiry",L"1221");
    json.UpdateString(L"amount",L"20");
    json.UpdateString(L"currency",L"USD");
    json.UpdateString(L"name",L"TOM JONES");
    json.UpdateString(L"address",L"123 MAIN STREET");
    json.UpdateString(L"city",L"anytown");
    json.UpdateString(L"region",L"NY");
    json.UpdateString(L"country",L"US");
    json.UpdateString(L"postal",L"55555");
    json.UpdateString(L"profile",L"Y");
    json.UpdateString(L"ecomind",L"E");
    json.UpdateString(L"cvv2",L"123");
    json.UpdateNull(L"track");
    json.UpdateString(L"capture",L"Y");

    const wchar_t *url = L"https://<site>.cardconnect.com:<port>/cardconnect/rest/auth";
    const wchar_t *responseStr = http.putText(url,json.emit(),L"utf-8",L"application/json",false,false);

    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",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.
    wprintf(L"response status code = %d\n",http.get_LastStatus());

    CkJsonObjectW jsonResp;
    jsonResp.Load(responseStr);
    jsonResp.put_EmitCompact(false);

    wprintf(L"response JSON:\n");
    wprintf(L"%s\n",jsonResp.emit());

    // Sample error:

    // {
    //   "respproc": "PPS",
    //   "amount": "0.00",
    //   "resptext": "Invalid amount",
    //   "cardproc": "FNOR",
    //   "acctid": "1",
    //   "retref": "112804260418",
    //   "respstat": "C",
    //   "respcode": "43",
    //   "account": "41XXXXXXXXXX1111",
    //   "defaultacct": "Y",
    //   "merchid": "MERCHANT_ID",
    //   "token": "9418594164541111"
    // }

    // A successful response looks like this:

    // {
    //   "amount": "0.20",
    //   "resptext": "Approval",
    //   "acctid": "1",
    //   "commcard": " C ",
    //   "cvvresp": "M",
    //   "respcode": "00",
    //   "batchid": "1900942291",
    //   "avsresp": "Z",
    //   "entrymode": "ECommerce",
    //   "defaultacct": "Y",
    //   "merchid": "MERCHANT_ID",
    //   "token": "9418594164541111",
    //   "authcode": "PPS158",
    //   "respproc": "FNOR",
    //   "bintype": "",
    //   "profileid": "16618402968441604028",
    //   "retref": "112989260941",
    //   "respstat": "A",
    //   "account": "41XXXXXXXXXX1111"
    // }

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

    const wchar_t *amount = jsonResp.stringOf(L"amount");
    const wchar_t *resptext = jsonResp.stringOf(L"resptext");
    const wchar_t *acctid = jsonResp.stringOf(L"acctid");
    const wchar_t *commcard = jsonResp.stringOf(L"commcard");
    const wchar_t *cvvresp = jsonResp.stringOf(L"cvvresp");
    const wchar_t *respcode = jsonResp.stringOf(L"respcode");
    const wchar_t *batchid = jsonResp.stringOf(L"batchid");
    const wchar_t *avsresp = jsonResp.stringOf(L"avsresp");
    const wchar_t *entrymode = jsonResp.stringOf(L"entrymode");
    const wchar_t *defaultacct = jsonResp.stringOf(L"defaultacct");
    const wchar_t *merchid = jsonResp.stringOf(L"merchid");
    const wchar_t *token = jsonResp.stringOf(L"token");
    const wchar_t *authcode = jsonResp.stringOf(L"authcode");
    const wchar_t *respproc = jsonResp.stringOf(L"respproc");
    const wchar_t *bintype = jsonResp.stringOf(L"bintype");
    const wchar_t *profileid = jsonResp.stringOf(L"profileid");
    const wchar_t *retref = jsonResp.stringOf(L"retref");
    const wchar_t *respstat = jsonResp.stringOf(L"respstat");
    const wchar_t *account = jsonResp.stringOf(L"account");
    }

 

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