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

DataFlex 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

 

 

 

(DataFlex) ClickBank Parse Instant Notification JSON

Demonstrates how to parse the JSON of a ClickBank instant notification.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoJson
    String sTransactionTime
    String sReceipt
    String sTransactionType
    String sVendor
    String sAffiliate
    String sRole
    String sTotalAccountAmount
    String sPaymentMethod
    String sTotalOrderAmount
    String sTotalTaxAmount
    String sTotalShippingAmount
    String sCurrency
    String sOrderLanguage
    String sCustomerShippingFirstName
    String sCustomerShippingLastName
    String sCustomerShippingFullName
    String sCustomerShippingPhoneNumber
    String sCustomerShippingEmail
    String sCustomerShippingAddressAddress1
    String sCustomerShippingAddressAddress2
    String sCustomerShippingAddressCity
    String sCustomerShippingAddressCounty
    String sCustomerShippingAddressState
    String sCustomerShippingAddressPostalCode
    String sCustomerShippingAddressCountry
    String sCustomerBillingFirstName
    String sCustomerBillingLastName
    String sCustomerBillingFullName
    String sCustomerBillingPhoneNumber
    String sCustomerBillingEmail
    String sCustomerBillingAddressState
    String sCustomerBillingAddressPostalCode
    String sCustomerBillingAddressCountry
    String sUpsellUpsellOriginalReceipt
    Integer iUpsellUpsellFlowId
    String sUpsellUpsellSession
    String sUpsellUpsellPath
    String sHopfeedHopfeedClickId
    Integer iHopfeedHopfeedApplicationId
    Integer iHopfeedHopfeedCreativeId
    String sHopfeedHopfeedApplicationPayout
    String sHopfeedHopfeedVendorPayout
    String sVersion
    Integer iAttemptCount
    String sVendorVariablesV1
    String sVendorVariablesV2
    Integer i
    Integer iCount_i
    String sStrVal
    String sItemNo
    String sProductTitle
    Boolean iShippable
    Boolean iRecurring
    String sAccountAmount
    Integer iQuantity
    String sDownloadUrl
    String sLineItemType

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End

    Get ComLoad Of hoJson "{  ...  }" To iSuccess

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

    // See the parsing code below..

    // Sample notification JSON: 

    // {
    //     "transactionTime": "2016-06-05T13:47:51-06:00",
    //     "receipt": "CWOGBZLN",
    //     "transactionType": "SALE",
    //     "vendor": "testacct",
    //     "affiliate": "affiliate1",
    //     "role": "VENDOR",
    //     "totalAccountAmount": 0.00,
    //     "paymentMethod": "VISA",
    //     "totalOrderAmount": 0.00,
    //     "totalTaxAmount": 0.00,
    //     "totalShippingAmount": 0.00,
    //     "currency": "USD",
    //     "orderLanguage": "EN",
    //     "trackingCodes": [
    //         "tracking_code"
    //     ],
    //     "lineItems": [
    //         {
    //             "itemNo": "1",
    //             "productTitle": "Product Title",
    //             "shippable": false,
    //             "recurring": false,
    //             "accountAmount": 5.00,
    //             "quantity": 1,
    //             "downloadUrl": "<download_url>"
    //             "lineItemType": "CART"
    //        }
    //         {
    //             "itemNo": "2",
    //             "productTitle": "Second Product",
    //             "shippable": false,
    //             "recurring": true,
    //             "accountAmount": 2.99,
    //             "quantity": 1,
    //             "downloadUrl": "<download_url>"
    //             "lineItemType": "CART"
    //        }
    // 
    //     ],
    //      "customer": {
    //         "shipping": {
    //             "firstName": "TEST",
    //             "lastName": "GUY",
    //             "fullName": "Test Guy",
    //             "phoneNumber": "",
    //             "email": "test@example.net",
    //             "address": {
    //                 "address1": "12 Test Lane",
    //                 "address2": "Suite 100",
    //                 "city": "LAS VEGAS",
    //                 "county": "LAS VEGAS",
    //                 "state": "NV",
    //                 "postalCode": "89101",
    //                 "country": "US"
    //             }
    //         },
    //         "billing": {
    //             "firstName": "TEST",
    //             "lastName": "GUY",
    //             "fullName": "Test Guy",
    //             "phoneNumber": "",
    //             "email": "test@example.net",
    //             "address": {
    //                 "state": "NV",
    //                 "postalCode": "89101",
    //                 "country": "US"
    //             }
    //         }
    //     },
    //      "upsell": {
    //         "upsellOriginalReceipt": "XXXXXXXX",
    //         "upsellFlowId": 55,
    //         "upsellSession": "VVVVVVVVVV",
    //         "upsellPath": "upsell_path"
    //     },
    //      "hopfeed": {
    //         "hopfeedClickId": "hopfeed_click",
    //         "hopfeedApplicationId": 0000,
    //         "hopfeedCreativeId": 0000,
    //         "hopfeedApplicationPayout": 0.00,
    //         "hopfeedVendorPayout": 0.00
    //     },
    //      "version": 6.0,
    //     "attemptCount": 1,
    //      "vendorVariables": {
    //        "v1": "variable1", 
    //        "v2": "variable2" 
    //     }
    //  }
    // 
    // 

    Get ComStringOf Of hoJson "transactionTime" To sTransactionTime
    Get ComStringOf Of hoJson "receipt" To sReceipt
    Get ComStringOf Of hoJson "transactionType" To sTransactionType
    Get ComStringOf Of hoJson "vendor" To sVendor
    Get ComStringOf Of hoJson "affiliate" To sAffiliate
    Get ComStringOf Of hoJson "role" To sRole
    Get ComStringOf Of hoJson "totalAccountAmount" To sTotalAccountAmount
    Get ComStringOf Of hoJson "paymentMethod" To sPaymentMethod
    Get ComStringOf Of hoJson "totalOrderAmount" To sTotalOrderAmount
    Get ComStringOf Of hoJson "totalTaxAmount" To sTotalTaxAmount
    Get ComStringOf Of hoJson "totalShippingAmount" To sTotalShippingAmount
    Get ComStringOf Of hoJson "currency" To sCurrency
    Get ComStringOf Of hoJson "orderLanguage" To sOrderLanguage
    Get ComStringOf Of hoJson "customer.shipping.firstName" To sCustomerShippingFirstName
    Get ComStringOf Of hoJson "customer.shipping.lastName" To sCustomerShippingLastName
    Get ComStringOf Of hoJson "customer.shipping.fullName" To sCustomerShippingFullName
    Get ComStringOf Of hoJson "customer.shipping.phoneNumber" To sCustomerShippingPhoneNumber
    Get ComStringOf Of hoJson "customer.shipping.email" To sCustomerShippingEmail
    Get ComStringOf Of hoJson "customer.shipping.address.address1" To sCustomerShippingAddressAddress1
    Get ComStringOf Of hoJson "customer.shipping.address.address2" To sCustomerShippingAddressAddress2
    Get ComStringOf Of hoJson "customer.shipping.address.city" To sCustomerShippingAddressCity
    Get ComStringOf Of hoJson "customer.shipping.address.county" To sCustomerShippingAddressCounty
    Get ComStringOf Of hoJson "customer.shipping.address.state" To sCustomerShippingAddressState
    Get ComStringOf Of hoJson "customer.shipping.address.postalCode" To sCustomerShippingAddressPostalCode
    Get ComStringOf Of hoJson "customer.shipping.address.country" To sCustomerShippingAddressCountry
    Get ComStringOf Of hoJson "customer.billing.firstName" To sCustomerBillingFirstName
    Get ComStringOf Of hoJson "customer.billing.lastName" To sCustomerBillingLastName
    Get ComStringOf Of hoJson "customer.billing.fullName" To sCustomerBillingFullName
    Get ComStringOf Of hoJson "customer.billing.phoneNumber" To sCustomerBillingPhoneNumber
    Get ComStringOf Of hoJson "customer.billing.email" To sCustomerBillingEmail
    Get ComStringOf Of hoJson "customer.billing.address.state" To sCustomerBillingAddressState
    Get ComStringOf Of hoJson "customer.billing.address.postalCode" To sCustomerBillingAddressPostalCode
    Get ComStringOf Of hoJson "customer.billing.address.country" To sCustomerBillingAddressCountry
    Get ComStringOf Of hoJson "upsell.upsellOriginalReceipt" To sUpsellUpsellOriginalReceipt
    Get ComIntOf Of hoJson "upsell.upsellFlowId" To iUpsellUpsellFlowId
    Get ComStringOf Of hoJson "upsell.upsellSession" To sUpsellUpsellSession
    Get ComStringOf Of hoJson "upsell.upsellPath" To sUpsellUpsellPath
    Get ComStringOf Of hoJson "hopfeed.hopfeedClickId" To sHopfeedHopfeedClickId
    Get ComIntOf Of hoJson "hopfeed.hopfeedApplicationId" To iHopfeedHopfeedApplicationId
    Get ComIntOf Of hoJson "hopfeed.hopfeedCreativeId" To iHopfeedHopfeedCreativeId
    Get ComStringOf Of hoJson "hopfeed.hopfeedApplicationPayout" To sHopfeedHopfeedApplicationPayout
    Get ComStringOf Of hoJson "hopfeed.hopfeedVendorPayout" To sHopfeedHopfeedVendorPayout
    Get ComStringOf Of hoJson "version" To sVersion
    Get ComIntOf Of hoJson "attemptCount" To iAttemptCount
    Get ComStringOf Of hoJson "vendorVariables.v1" To sVendorVariablesV1
    Get ComStringOf Of hoJson "vendorVariables.v2" To sVendorVariablesV2
    Move 0 To i
    Get ComSizeOfArray Of hoJson "trackingCodes" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "trackingCodes[i]" To sStrVal
        Move i + 1 To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJson "lineItems" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson "lineItems[i].itemNo" To sItemNo
        Get ComStringOf Of hoJson "lineItems[i].productTitle" To sProductTitle
        Get ComBoolOf Of hoJson "lineItems[i].shippable" To iShippable
        Get ComBoolOf Of hoJson "lineItems[i].recurring" To iRecurring
        Get ComStringOf Of hoJson "lineItems[i].accountAmount" To sAccountAmount
        Get ComIntOf Of hoJson "lineItems[i].quantity" To iQuantity
        Get ComStringOf Of hoJson "lineItems[i].downloadUrl" To sDownloadUrl
        Get ComStringOf Of hoJson "lineItems[i].lineItemType" To sLineItemType
        Move i + 1 To i
    Loop



End_Procedure

 

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