PowerBuilder
PowerBuilder
ClickBank Parse Instant Notification JSON
See more ClickBank Examples
Demonstrates how to parse the JSON of a ClickBank instant notification.Chilkat PowerBuilder Downloads
integer li_rc
oleobject loo_Json
string ls_TransactionTime
string ls_Receipt
string ls_TransactionType
string ls_Vendor
string ls_Affiliate
string ls_Role
string ls_TotalAccountAmount
string ls_PaymentMethod
string ls_TotalOrderAmount
string ls_TotalTaxAmount
string ls_TotalShippingAmount
string ls_Currency
string ls_OrderLanguage
string ls_CustomerShippingFirstName
string ls_CustomerShippingLastName
string ls_CustomerShippingFullName
string ls_CustomerShippingPhoneNumber
string ls_CustomerShippingEmail
string ls_CustomerShippingAddressAddress1
string ls_CustomerShippingAddressAddress2
string ls_CustomerShippingAddressCity
string ls_CustomerShippingAddressCounty
string ls_CustomerShippingAddressState
string ls_CustomerShippingAddressPostalCode
string ls_CustomerShippingAddressCountry
string ls_CustomerBillingFirstName
string ls_CustomerBillingLastName
string ls_CustomerBillingFullName
string ls_CustomerBillingPhoneNumber
string ls_CustomerBillingEmail
string ls_CustomerBillingAddressState
string ls_CustomerBillingAddressPostalCode
string ls_CustomerBillingAddressCountry
string ls_UpsellUpsellOriginalReceipt
integer li_UpsellUpsellFlowId
string ls_UpsellUpsellSession
string ls_UpsellUpsellPath
string ls_HopfeedHopfeedClickId
integer li_HopfeedHopfeedApplicationId
integer li_HopfeedHopfeedCreativeId
string ls_HopfeedHopfeedApplicationPayout
string ls_HopfeedHopfeedVendorPayout
string ls_Version
integer li_AttemptCount
string ls_VendorVariablesV1
string ls_VendorVariablesV2
integer i
integer li_Count_i
string ls_StrVal
string ls_ItemNo
string ls_ProductTitle
integer li_Shippable
integer li_Recurring
string ls_AccountAmount
integer li_Quantity
string ls_DownloadUrl
string ls_LineItemType
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
if li_rc < 0 then
destroy loo_Json
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Json.Load("{ ... }")
// 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"
// }
// }
//
//
ls_TransactionTime = loo_Json.StringOf("transactionTime")
ls_Receipt = loo_Json.StringOf("receipt")
ls_TransactionType = loo_Json.StringOf("transactionType")
ls_Vendor = loo_Json.StringOf("vendor")
ls_Affiliate = loo_Json.StringOf("affiliate")
ls_Role = loo_Json.StringOf("role")
ls_TotalAccountAmount = loo_Json.StringOf("totalAccountAmount")
ls_PaymentMethod = loo_Json.StringOf("paymentMethod")
ls_TotalOrderAmount = loo_Json.StringOf("totalOrderAmount")
ls_TotalTaxAmount = loo_Json.StringOf("totalTaxAmount")
ls_TotalShippingAmount = loo_Json.StringOf("totalShippingAmount")
ls_Currency = loo_Json.StringOf("currency")
ls_OrderLanguage = loo_Json.StringOf("orderLanguage")
ls_CustomerShippingFirstName = loo_Json.StringOf("customer.shipping.firstName")
ls_CustomerShippingLastName = loo_Json.StringOf("customer.shipping.lastName")
ls_CustomerShippingFullName = loo_Json.StringOf("customer.shipping.fullName")
ls_CustomerShippingPhoneNumber = loo_Json.StringOf("customer.shipping.phoneNumber")
ls_CustomerShippingEmail = loo_Json.StringOf("customer.shipping.email")
ls_CustomerShippingAddressAddress1 = loo_Json.StringOf("customer.shipping.address.address1")
ls_CustomerShippingAddressAddress2 = loo_Json.StringOf("customer.shipping.address.address2")
ls_CustomerShippingAddressCity = loo_Json.StringOf("customer.shipping.address.city")
ls_CustomerShippingAddressCounty = loo_Json.StringOf("customer.shipping.address.county")
ls_CustomerShippingAddressState = loo_Json.StringOf("customer.shipping.address.state")
ls_CustomerShippingAddressPostalCode = loo_Json.StringOf("customer.shipping.address.postalCode")
ls_CustomerShippingAddressCountry = loo_Json.StringOf("customer.shipping.address.country")
ls_CustomerBillingFirstName = loo_Json.StringOf("customer.billing.firstName")
ls_CustomerBillingLastName = loo_Json.StringOf("customer.billing.lastName")
ls_CustomerBillingFullName = loo_Json.StringOf("customer.billing.fullName")
ls_CustomerBillingPhoneNumber = loo_Json.StringOf("customer.billing.phoneNumber")
ls_CustomerBillingEmail = loo_Json.StringOf("customer.billing.email")
ls_CustomerBillingAddressState = loo_Json.StringOf("customer.billing.address.state")
ls_CustomerBillingAddressPostalCode = loo_Json.StringOf("customer.billing.address.postalCode")
ls_CustomerBillingAddressCountry = loo_Json.StringOf("customer.billing.address.country")
ls_UpsellUpsellOriginalReceipt = loo_Json.StringOf("upsell.upsellOriginalReceipt")
li_UpsellUpsellFlowId = loo_Json.IntOf("upsell.upsellFlowId")
ls_UpsellUpsellSession = loo_Json.StringOf("upsell.upsellSession")
ls_UpsellUpsellPath = loo_Json.StringOf("upsell.upsellPath")
ls_HopfeedHopfeedClickId = loo_Json.StringOf("hopfeed.hopfeedClickId")
li_HopfeedHopfeedApplicationId = loo_Json.IntOf("hopfeed.hopfeedApplicationId")
li_HopfeedHopfeedCreativeId = loo_Json.IntOf("hopfeed.hopfeedCreativeId")
ls_HopfeedHopfeedApplicationPayout = loo_Json.StringOf("hopfeed.hopfeedApplicationPayout")
ls_HopfeedHopfeedVendorPayout = loo_Json.StringOf("hopfeed.hopfeedVendorPayout")
ls_Version = loo_Json.StringOf("version")
li_AttemptCount = loo_Json.IntOf("attemptCount")
ls_VendorVariablesV1 = loo_Json.StringOf("vendorVariables.v1")
ls_VendorVariablesV2 = loo_Json.StringOf("vendorVariables.v2")
i = 0
li_Count_i = loo_Json.SizeOfArray("trackingCodes")
do while i < li_Count_i
loo_Json.I = i
ls_StrVal = loo_Json.StringOf("trackingCodes[i]")
i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("lineItems")
do while i < li_Count_i
loo_Json.I = i
ls_ItemNo = loo_Json.StringOf("lineItems[i].itemNo")
ls_ProductTitle = loo_Json.StringOf("lineItems[i].productTitle")
li_Shippable = loo_Json.BoolOf("lineItems[i].shippable")
li_Recurring = loo_Json.BoolOf("lineItems[i].recurring")
ls_AccountAmount = loo_Json.StringOf("lineItems[i].accountAmount")
li_Quantity = loo_Json.IntOf("lineItems[i].quantity")
ls_DownloadUrl = loo_Json.StringOf("lineItems[i].downloadUrl")
ls_LineItemType = loo_Json.StringOf("lineItems[i].lineItemType")
i = i + 1
loop
destroy loo_Json