Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C++) ClickBank Parse Instant Notification JSONDemonstrates how to parse the JSON of a ClickBank instant notification.
#include <CkJsonObjectW.h> void ChilkatSample(void) { CkJsonObjectW json; json.Load(L"{ ... }"); // 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" // } // } // // const wchar_t *transactionTime = 0; const wchar_t *receipt = 0; const wchar_t *transactionType = 0; const wchar_t *vendor = 0; const wchar_t *affiliate = 0; const wchar_t *role = 0; const wchar_t *totalAccountAmount = 0; const wchar_t *paymentMethod = 0; const wchar_t *totalOrderAmount = 0; const wchar_t *totalTaxAmount = 0; const wchar_t *totalShippingAmount = 0; const wchar_t *currency = 0; const wchar_t *orderLanguage = 0; const wchar_t *customerShippingFirstName = 0; const wchar_t *customerShippingLastName = 0; const wchar_t *customerShippingFullName = 0; const wchar_t *customerShippingPhoneNumber = 0; const wchar_t *customerShippingEmail = 0; const wchar_t *customerShippingAddressAddress1 = 0; const wchar_t *customerShippingAddressAddress2 = 0; const wchar_t *customerShippingAddressCity = 0; const wchar_t *customerShippingAddressCounty = 0; const wchar_t *customerShippingAddressState = 0; const wchar_t *customerShippingAddressPostalCode = 0; const wchar_t *customerShippingAddressCountry = 0; const wchar_t *customerBillingFirstName = 0; const wchar_t *customerBillingLastName = 0; const wchar_t *customerBillingFullName = 0; const wchar_t *customerBillingPhoneNumber = 0; const wchar_t *customerBillingEmail = 0; const wchar_t *customerBillingAddressState = 0; const wchar_t *customerBillingAddressPostalCode = 0; const wchar_t *customerBillingAddressCountry = 0; const wchar_t *upsellUpsellOriginalReceipt = 0; int upsellUpsellFlowId; const wchar_t *upsellUpsellSession = 0; const wchar_t *upsellUpsellPath = 0; const wchar_t *hopfeedHopfeedClickId = 0; int hopfeedHopfeedApplicationId; int hopfeedHopfeedCreativeId; const wchar_t *hopfeedHopfeedApplicationPayout = 0; const wchar_t *hopfeedHopfeedVendorPayout = 0; const wchar_t *version = 0; int attemptCount; const wchar_t *vendorVariablesV1 = 0; const wchar_t *vendorVariablesV2 = 0; int i; int count_i; const wchar_t *strVal = 0; const wchar_t *itemNo = 0; const wchar_t *productTitle = 0; bool shippable; bool recurring; const wchar_t *accountAmount = 0; int quantity; const wchar_t *downloadUrl = 0; const wchar_t *lineItemType = 0; transactionTime = json.stringOf(L"transactionTime"); receipt = json.stringOf(L"receipt"); transactionType = json.stringOf(L"transactionType"); vendor = json.stringOf(L"vendor"); affiliate = json.stringOf(L"affiliate"); role = json.stringOf(L"role"); totalAccountAmount = json.stringOf(L"totalAccountAmount"); paymentMethod = json.stringOf(L"paymentMethod"); totalOrderAmount = json.stringOf(L"totalOrderAmount"); totalTaxAmount = json.stringOf(L"totalTaxAmount"); totalShippingAmount = json.stringOf(L"totalShippingAmount"); currency = json.stringOf(L"currency"); orderLanguage = json.stringOf(L"orderLanguage"); customerShippingFirstName = json.stringOf(L"customer.shipping.firstName"); customerShippingLastName = json.stringOf(L"customer.shipping.lastName"); customerShippingFullName = json.stringOf(L"customer.shipping.fullName"); customerShippingPhoneNumber = json.stringOf(L"customer.shipping.phoneNumber"); customerShippingEmail = json.stringOf(L"customer.shipping.email"); customerShippingAddressAddress1 = json.stringOf(L"customer.shipping.address.address1"); customerShippingAddressAddress2 = json.stringOf(L"customer.shipping.address.address2"); customerShippingAddressCity = json.stringOf(L"customer.shipping.address.city"); customerShippingAddressCounty = json.stringOf(L"customer.shipping.address.county"); customerShippingAddressState = json.stringOf(L"customer.shipping.address.state"); customerShippingAddressPostalCode = json.stringOf(L"customer.shipping.address.postalCode"); customerShippingAddressCountry = json.stringOf(L"customer.shipping.address.country"); customerBillingFirstName = json.stringOf(L"customer.billing.firstName"); customerBillingLastName = json.stringOf(L"customer.billing.lastName"); customerBillingFullName = json.stringOf(L"customer.billing.fullName"); customerBillingPhoneNumber = json.stringOf(L"customer.billing.phoneNumber"); customerBillingEmail = json.stringOf(L"customer.billing.email"); customerBillingAddressState = json.stringOf(L"customer.billing.address.state"); customerBillingAddressPostalCode = json.stringOf(L"customer.billing.address.postalCode"); customerBillingAddressCountry = json.stringOf(L"customer.billing.address.country"); upsellUpsellOriginalReceipt = json.stringOf(L"upsell.upsellOriginalReceipt"); upsellUpsellFlowId = json.IntOf(L"upsell.upsellFlowId"); upsellUpsellSession = json.stringOf(L"upsell.upsellSession"); upsellUpsellPath = json.stringOf(L"upsell.upsellPath"); hopfeedHopfeedClickId = json.stringOf(L"hopfeed.hopfeedClickId"); hopfeedHopfeedApplicationId = json.IntOf(L"hopfeed.hopfeedApplicationId"); hopfeedHopfeedCreativeId = json.IntOf(L"hopfeed.hopfeedCreativeId"); hopfeedHopfeedApplicationPayout = json.stringOf(L"hopfeed.hopfeedApplicationPayout"); hopfeedHopfeedVendorPayout = json.stringOf(L"hopfeed.hopfeedVendorPayout"); version = json.stringOf(L"version"); attemptCount = json.IntOf(L"attemptCount"); vendorVariablesV1 = json.stringOf(L"vendorVariables.v1"); vendorVariablesV2 = json.stringOf(L"vendorVariables.v2"); i = 0; count_i = json.SizeOfArray(L"trackingCodes"); while (i < count_i) { json.put_I(i); strVal = json.stringOf(L"trackingCodes[i]"); i = i + 1; } i = 0; count_i = json.SizeOfArray(L"lineItems"); while (i < count_i) { json.put_I(i); itemNo = json.stringOf(L"lineItems[i].itemNo"); productTitle = json.stringOf(L"lineItems[i].productTitle"); shippable = json.BoolOf(L"lineItems[i].shippable"); recurring = json.BoolOf(L"lineItems[i].recurring"); accountAmount = json.stringOf(L"lineItems[i].accountAmount"); quantity = json.IntOf(L"lineItems[i].quantity"); downloadUrl = json.stringOf(L"lineItems[i].downloadUrl"); lineItemType = json.stringOf(L"lineItems[i].lineItemType"); i = i + 1; } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.