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

SQL Server 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
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

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
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
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

 

 

 

(SQL Server) 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 ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    -- This example assumes the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @http int
    -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    EXEC sp_OASetProperty @http, 'BasicAuth', 1
    EXEC sp_OASetProperty @http, 'Login', 'API_USERNAME'
    EXEC sp_OASetProperty @http, 'Password', 'API_PASSWORD'

    DECLARE @url nvarchar(4000)
    SELECT @url = 'https://<site>.cardconnect.com:<port>/cardconnect/rest/funding?merchid=<merchid>&date=<MMDD>'
    DECLARE @responseStr nvarchar(4000)
    EXEC sp_OAMethod @http, 'QuickGetStr', @responseStr OUT, @url
    EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        RETURN
      END

    -- 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.

    EXEC sp_OAGetProperty @http, 'LastStatus', @iTmp0 OUT
    PRINT 'response status code = ' + @iTmp0

    DECLARE @jsonResp int
    -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jsonResp OUT

    EXEC sp_OAMethod @jsonResp, 'Load', @success OUT, @responseStr
    EXEC sp_OASetProperty @jsonResp, 'EmitCompact', 0


    PRINT 'response JSON:'
    EXEC sp_OAMethod @jsonResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    -- 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

    DECLARE @fundingmasterid int

    DECLARE @fundingdate nvarchar(4000)

    DECLARE @datechanged nvarchar(4000)

    DECLARE @merchid nvarchar(4000)

    DECLARE @i int

    DECLARE @count_i int

    DECLARE @amount nvarchar(4000)

    DECLARE @fundingadjustmentid int

    DECLARE @description nvarchar(4000)

    DECLARE @currency nvarchar(4000)

    DECLARE @category nvarchar(4000)

    DECLARE @v_type nvarchar(4000)

    DECLARE @dateadded nvarchar(4000)

    DECLARE @fundingid int

    DECLARE @netsales nvarchar(4000)

    DECLARE @totalfunding nvarchar(4000)

    DECLARE @fee nvarchar(4000)

    DECLARE @deposittrancode nvarchar(4000)

    DECLARE @ddanumber nvarchar(4000)

    DECLARE @thirdparty nvarchar(4000)

    DECLARE @reversal nvarchar(4000)

    DECLARE @interchangefee nvarchar(4000)

    DECLARE @adjustment nvarchar(4000)

    DECLARE @depositachtracenumber nvarchar(4000)

    DECLARE @servicecharge nvarchar(4000)

    DECLARE @otheradjustment nvarchar(4000)

    DECLARE @abanumber nvarchar(4000)

    DECLARE @date nvarchar(4000)

    DECLARE @downgradereasoncodes nvarchar(4000)

    DECLARE @cardproc nvarchar(4000)

    DECLARE @sourcetransactionid nvarchar(4000)

    DECLARE @batchid int

    DECLARE @respcode nvarchar(4000)

    DECLARE @interchangeunitfee nvarchar(4000)

    DECLARE @authcode nvarchar(4000)

    DECLARE @plancode nvarchar(4000)

    DECLARE @authdate int

    DECLARE @fundingtxnid int

    DECLARE @cardbrand nvarchar(4000)

    DECLARE @terminalnumber nvarchar(4000)

    DECLARE @cardnumber nvarchar(4000)

    DECLARE @cardtype nvarchar(4000)

    DECLARE @retref nvarchar(4000)

    DECLARE @status nvarchar(4000)

    DECLARE @interchangepercentfee nvarchar(4000)

    DECLARE @invoicenumber nvarchar(4000)

    EXEC sp_OAMethod @jsonResp, 'IntOf', @fundingmasterid OUT, 'fundingmasterid'
    EXEC sp_OAMethod @jsonResp, 'StringOf', @fundingdate OUT, 'fundingdate'
    EXEC sp_OAMethod @jsonResp, 'StringOf', @datechanged OUT, 'datechanged'
    EXEC sp_OAMethod @jsonResp, 'StringOf', @merchid OUT, 'merchid'
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResp, 'SizeOfArray', @count_i OUT, 'adjustments'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResp, 'I', @i
        EXEC sp_OAMethod @jsonResp, 'IntOf', @fundingmasterid OUT, 'adjustments[i].fundingmasterid'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @amount OUT, 'adjustments[i].amount'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @datechanged OUT, 'adjustments[i].datechanged'
        EXEC sp_OAMethod @jsonResp, 'IntOf', @fundingadjustmentid OUT, 'adjustments[i].fundingadjustmentid'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @description OUT, 'adjustments[i].description'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @currency OUT, 'adjustments[i].currency'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @category OUT, 'adjustments[i].category'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @v_type OUT, 'adjustments[i].type'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @dateadded OUT, 'adjustments[i].dateadded'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @merchid OUT, 'adjustments[i].merchid'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResp, 'SizeOfArray', @count_i OUT, 'fundings'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResp, 'I', @i
        EXEC sp_OAMethod @jsonResp, 'IntOf', @fundingid OUT, 'fundings[i].fundingid'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @netsales OUT, 'fundings[i].netsales'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @totalfunding OUT, 'fundings[i].totalfunding'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @fee OUT, 'fundings[i].fee'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @datechanged OUT, 'fundings[i].datechanged'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @deposittrancode OUT, 'fundings[i].deposittrancode'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @ddanumber OUT, 'fundings[i].ddanumber'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @thirdparty OUT, 'fundings[i].thirdparty'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @dateadded OUT, 'fundings[i].dateadded'
        EXEC sp_OAMethod @jsonResp, 'IntOf', @fundingmasterid OUT, 'fundings[i].fundingmasterid'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @reversal OUT, 'fundings[i].reversal'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @interchangefee OUT, 'fundings[i].interchangefee'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @adjustment OUT, 'fundings[i].adjustment'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @currency OUT, 'fundings[i].currency'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @depositachtracenumber OUT, 'fundings[i].depositachtracenumber'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @servicecharge OUT, 'fundings[i].servicecharge'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @otheradjustment OUT, 'fundings[i].otheradjustment'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @abanumber OUT, 'fundings[i].abanumber'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jsonResp, 'SizeOfArray', @count_i OUT, 'txns'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jsonResp, 'I', @i
        EXEC sp_OAMethod @jsonResp, 'StringOf', @date OUT, 'txns[i].date'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @amount OUT, 'txns[i].amount'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @downgradereasoncodes OUT, 'txns[i].downgradereasoncodes'
        EXEC sp_OAMethod @jsonResp, 'IntOf', @fundingid OUT, 'txns[i].fundingid'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @cardproc OUT, 'txns[i].cardproc'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @sourcetransactionid OUT, 'txns[i].sourcetransactionid'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @v_type OUT, 'txns[i].type'
        EXEC sp_OAMethod @jsonResp, 'IntOf', @batchid OUT, 'txns[i].batchid'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @respcode OUT, 'txns[i].respcode'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @interchangeunitfee OUT, 'txns[i].interchangeunitfee'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @authcode OUT, 'txns[i].authcode'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @plancode OUT, 'txns[i].plancode'
        EXEC sp_OAMethod @jsonResp, 'IntOf', @authdate OUT, 'txns[i].authdate'
        EXEC sp_OAMethod @jsonResp, 'IntOf', @fundingtxnid OUT, 'txns[i].fundingtxnid'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @cardbrand OUT, 'txns[i].cardbrand'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @currency OUT, 'txns[i].currency'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @terminalnumber OUT, 'txns[i].terminalnumber'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @cardnumber OUT, 'txns[i].cardnumber'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @cardtype OUT, 'txns[i].cardtype'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @retref OUT, 'txns[i].retref'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @status OUT, 'txns[i].status'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @interchangepercentfee OUT, 'txns[i].interchangepercentfee'
        EXEC sp_OAMethod @jsonResp, 'StringOf', @invoicenumber OUT, 'txns[i].invoicenumber'
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @jsonResp


END
GO

 

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