Sample code for 30+ languages & platforms
Lua Requires Chilkat v11.0.0+

Ecwid - Search Orders

See more Ecwid Examples

Search or filter orders in an Ecwid store. The response provides full details of the found orders.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

-- This example has more top-level variables than Lua allows locals in one function (200),
-- so they are global variables.

-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.

http = chilkat.Http.new()

-- Implements the following CURL command:

-- curl --request GET \
--      --url 'https://app.ecwid.com/api/v3/storeId/orders?token=token' \
--      --header 'Accept: application/json'

-- Use the following online tool to generate HTTP code from a CURL command
-- Convert a cURL Command to HTTP Source Code

-- Load the access token previously obtained in Ecwid Get Access Token
jsonToken = chilkat.JsonObject.new()
jsonToken:load_file("qa_data/tokens/ecwid.json")

http:set_request_header("Accept", "application/json")

params = chilkat.JsonObject.new()
params:update_int("limit", 100)
params:update_string("email", "joe@example.com")
params:update_string("token", jsonToken:string_of("access_token"))

resp = chilkat.HttpResponse.new()
success = http:http_params("GET", "https://app.ecwid.com/api/v3/storeId/orders", params, resp)
if not success then
    print(http.last_error_text)
    return
end

sbResponseBody = chilkat.StringBuilder.new()
resp:get_body_sb(sbResponseBody)
jResp = chilkat.JsonObject.new()
jResp:load_sb(sbResponseBody)
jResp.emit_compact = false

print("Response Body:")
print(jResp:emit())

respStatusCode = resp.status_code

print("Response Status Code = " .. respStatusCode)
if respStatusCode ~= 200 then
    print("Failed.")
    return
end

-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)

-- {
--   "total": 1,
--   "count": 1,
--   "offset": 0,
--   "limit": 100,
--   "items": [
--     {
--       "id": "XJ12H",
--       "subtotal": 1076.64,
--       "total": 2014.97,
--       "giftCardRedemption": 2.23,
--       "totalBeforeGiftCardRedemption": 2.23,
--       "giftCardDoubleSpending": false,
--       "usdTotal": 2014.97,
--       "tax": 488.48,
--       "paymentMethod": "Credit or debit card (Mollie)",
--       "paymentStatus": "PARTIALLY_REFUNDED",
--       "fulfillmentStatus": "DELIVERED",
--       "vendorOrderNumber": "XJ12H",
--       "orderNumber": 1082727626,
--       "refererUrl": "https://mdemo.ecwid.com/",
--       "globalReferer": "https://my.ecwid.com/",
--       "createDate": "2018-05-31 15:08:36 +0000",
--       "updateDate": "2018-05-31 15:09:35 +0000",
--       "createTimestamp": 1527779316,
--       "updateTimestamp": 1527779375,
--       "hidden": false,
--       "orderComments": "Test order comments",
--       "privateAdminNotes": "Must be delivered till Sunday.",
--       "email": "mscott@gmail.com",
--       "ipAddress": "123.431.234.243",
--       "customerId": 40201284,
--       "customerGroupId": 12345,
--       "customerGroup": "Gold",
--       "customerTaxExempt": false,
--       "customerTaxId": "",
--       "customerTaxIdValid": false,
--       "reversedTaxApplied": false,
--       "discount": 4,
--       "couponDiscount": 22,
--       "volumeDiscount": 4,
--       "membershipBasedDiscount": 0,
--       "totalAndMembershipBasedDiscount": 0,
--       "customDiscount": [
--       ],
--       "discountCoupon": {
--         "id": 29567026,
--         "name": "API Testing",
--         "code": "APITESTING",
--         "discountType": "ABS",
--         "status": "ACTIVE",
--         "discount": 22,
--         "launchDate": "2018-05-24 20:00:00 +0000",
--         "usesLimit": "UNLIMITED",
--         "applicationLimit": "UNLIMITED",
--         "creationDate": "2018-05-31 15:08:33 +0000",
--         "updateDate": "2018-05-24 13:40:32 +0000",
--         "orderCount": 0
--       },
--       "discountInfo": [
--         {
--           "value": 4,
--           "type": "ABS",
--           "base": "ON_TOTAL",
--           "orderTotal": 1
--         }
--       ],
--       "items": [
--         {
--           "id": 140273658,
--           "productId": 66722487,
--           "categoryId": 19563207,
--           "price": 1060,
--           "productPrice": 1000,
--           "sku": "ABCA-IAC",
--           "quantity": 1,
--           "shortDescription": "",
--           "tax": 331.01,
--           "shipping": 0,
--           "quantityInStock": 0,
--           "name": "iMac",
--           "isShippingRequired": true,
--           "weight": 0,
--           "trackQuantity": false,
--           "fixedShippingRateOnly": false,
--           "imageUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/391870914.jpg",
--           "smallThumbnailUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/650638292.jpg",
--           "hdThumbnailUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/650638293.jpg",
--           "fixedShippingRate": 0,
--           "digital": false,
--           "couponApplied": true,
--           "selectedOptions": [
--             {
--               "name": "Price-Optimizer",
--               "value": "6",
--               "valuesArray": [
--                 "6"
--               ],
--               "selections": [
--                 {
--                   "selectionTitle": "6",
--                   "selectionModifier": 6,
--                   "selectionModifierType": "PERCENT"
--                 }
--               ],
--               "type": "CHOICE"
--             }
--           ],
--           "taxes": [
--             {
--               "name": "State tax",
--               "value": 12,
--               "total": 124.13,
--               "taxOnDiscountedSubtotal": 124.13,
--               "taxOnShipping": 0,
--               "includeInPrice": false
--             },
--             {
--               "name": "TVA",
--               "value": 20,
--               "total": 206.88,
--               "taxOnDiscountedSubtotal": 206.88,
--               "taxOnShipping": 0,
--               "includeInPrice": true
--             }
--           ],
--           "dimensions": {
--             "length": 0,
--             "width": 0,
--             "height": 0
--           },
--           "couponAmount": 21.66,
--           "discounts": [
--             {
--               "discountInfo": {
--                 "value": 4,
--                 "type": "ABS",
--                 "base": "ON_TOTAL",
--                 "orderTotal": 1
--               },
--               "total": 3.94
--             }
--           ]
--         },
--         {
--           "id": 140273659,
--           "productId": 66821181,
--           "categoryId": 0,
--           "price": 16.64,
--           "productPrice": 16,
--           "sku": "001001",
--           "quantity": 1,
--           "shortDescription": "This sturdy white, glossy ceramic mug is an essential to your cupboard. This brawny version of ceramic mugs shows it’s ...",
--           "tax": 157.47,
--           "shipping": 471.85,
--           "quantityInStock": 0,
--           "name": "Mug",
--           "isShippingRequired": true,
--           "weight": 0.4,
--           "trackQuantity": false,
--           "fixedShippingRateOnly": false,
--           "imageUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/389900000.jpg",
--           "smallThumbnailUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/475772545.jpg",
--           "hdThumbnailUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/408631478.jpg",
--           "fixedShippingRate": 0,
--           "digital": false,
--           "couponApplied": true,
--           "selectedOptions": [
--             {
--               "name": "Color",
--               "value": "White",
--               "valuesArray": [
--                 "White"
--               ],
--               "selections": [
--                 {
--                   "selectionTitle": "White",
--                   "selectionModifier": 0,
--                   "selectionModifierType": "ABSOLUTE"
--                 }
--               ],
--               "type": "CHOICE"
--             },
--             {
--               "name": "Size",
--               "value": "11oz",
--               "valuesArray": [
--                 "11oz"
--               ],
--               "selections": [
--                 {
--                   "selectionTitle": "11oz",
--                   "selectionModifier": 0,
--                   "selectionModifierType": "ABSOLUTE"
--                 }
--               ],
--               "type": "CHOICE"
--             },
--             {
--               "name": "Price-Optimizer",
--               "value": "4",
--               "valuesArray": [
--                 "4"
--               ],
--               "selections": [
--                 {
--                   "selectionTitle": "4",
--                   "selectionModifier": 4,
--                   "selectionModifierType": "PERCENT"
--                 }
--               ],
--               "type": "CHOICE"
--             }
--           ],
--           "taxes": [
--             {
--               "name": "State tax",
--               "value": 12,
--               "total": 59.05,
--               "taxOnDiscountedSubtotal": 1.95,
--               "taxOnShipping": 57.1,
--               "includeInPrice": false
--             },
--             {
--               "name": "TVA",
--               "value": 20,
--               "total": 98.42,
--               "taxOnDiscountedSubtotal": 3.25,
--               "taxOnShipping": 95.17,
--               "includeInPrice": true
--             }
--           ],
--           "dimensions": {
--             "length": 0,
--             "width": 0,
--             "height": 0
--           },
--           "couponAmount": 0.34,
--           "discounts": [
--             {
--               "discountInfo": {
--                 "value": 4,
--                 "type": "ABS",
--                 "base": "ON_TOTAL",
--                 "orderTotal": 1
--               },
--               "total": 0.06
--             }
--           ]
--         },
--         {
--           "subscriptionId": 123456,
--           "recurringChargeSettings": {
--             "recurringInterval": "month",
--             "recurringIntervalCount": 1
--           }
--         }
--       ],
--       "refundedAmount": 3.5,
--       "refunds": [
--         {
--           "date": "2017-09-12 10:12:56 +0000",
--           "source": "CP",
--           "reason": "Testing!",
--           "amount": 3.5
--         }
--       ],
--       "billingPerson": {
--         "name": "Michael Scott",
--         "companyName": "",
--         "street": "555 Lackawanna Ave",
--         "city": "Scranton",
--         "countryCode": "US",
--         "countryName": "United States",
--         "postalCode": "18508",
--         "stateOrProvinceCode": "PA",
--         "stateOrProvinceName": "Pennsylvania",
--         "phone": ""
--       },
--       "shippingPerson": {
--         "name": "Michael Scott",
--         "companyName": "",
--         "street": "555 Lackawanna Ave",
--         "city": "Scranton",
--         "countryCode": "US",
--         "countryName": "United States",
--         "postalCode": "18508",
--         "stateOrProvinceCode": "PA",
--         "stateOrProvinceName": "Pennsylvania",
--         "phone": ""
--       },
--       "shippingOption": {
--         "shippingCarrierName": "Shipping app the-printful",
--         "shippingMethodName": "USPS Priority Mail",
--         "shippingRate": 471.85,
--         "estimatedTransitTime": "1-3",
--         "isPickup": false
--       },
--       "handlingFee": {
--         "name": "Handling Fee",
--         "value": 4,
--         "description": ""
--       },
--       "predictedPackage": [
--         {
--           "length": 0,
--           "width": 0,
--           "height": 0,
--           "weight": 0.4,
--           "declaredValue": 1076.64
--         }
--       ],
--       "shipments": [
--         {
--           "id": "5e79bd4f-9ebf-4ab8-b901-24c9b48b19eb",
--           "created": "2020-04-23 19:13:43 +0000",
--           "shipTo": {
--             "name": "Michael Scott",
--             "companyName": "",
--             "street": "555 Lackawanna Ave",
--             "city": "Scranton",
--             "countryCode": "US",
--             "countryName": "United States",
--             "postalCode": "18508",
--             "stateOrProvinceCode": "PA",
--             "stateOrProvinceName": "Pennsylvania",
--             "phone": ""
--           },
--           "shipFrom": {
--             "companyName": "Roga Kopyty Inc",
--             "street": "444 fff",
--             "city": "New York",
--             "countryCode": "US",
--             "countryName": "United States",
--             "postalCode": "10001",
--             "stateOrProvinceCode": "NY",
--             "stateOrProvinceName": "New York",
--             "phone": "1011991919"
--           },
--           "parcel": {
--             "weight": 0.5,
--             "weightUnit": 'KILOGRAM',
--             "width": 10,
--             "height": 10,
--             "length": 10,
--             "dimensionUnit": 'CM'
--           },
--           "shippingService": {
--             "carrier": 'USPS',
--             "carrierName": 'Shipping,
--             "carrierServiceName": "Priority Mail",
--             "carrierServiceCode": "usps_priority"
--           },
--           "tracking": {
--             "tracking_number": "9499907123456123456781",
--             "tracking_url": "https://tools.usps.com/go/TrackConfirmAction_input?origTrackNum=9499907123456123456781",
--             "estimatedDays": 3
--           },
--           "shippingLabel": {
--             "label_url": "https://shippo-delivery.s3.amazonaws.com/70ae8117ee1749e393f249d5b77c45e0.pdf?Signature=vDw1ltcyGveVR1OQoUDdzC43BY8%3D&Expires=1437093830&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA",
--             "commercial_invoice_url": ""
--           }
--         }
--       ],
--       "taxesOnShipping": [
--         {
--           "name": "State tax",
--           "value": 12,
--           "total": 57.1
--         },
--         {
--           "name": "TVA",
--           "value": 20,
--           "total": 95.17
--         }
--       ],
--       "paymentModule": "CUSTOM_PAYMENT_APP-mollie-pg",
--       "additionalInfo": {
--         "google_customer_id": "2008512504.1526280224"
--       },
--       "paymentParams": {},
--       "orderExtraFields": [
--         {
--           "id": "lang",
--           "value": "en",
--           "customerInputType": "",
--           "title": "",
--           "orderDetailsDisplaySection": "",
--           "orderBy": "1"
--         },
--         {
--           "id": "askHowYouFoundUsApp",
--           "value": "From a friend",
--           "customerInputType": "SELECT",
--           "title": "How did you hear about us?",
--           "orderDetailsDisplaySection": "order_comments",
--           "orderBy": "2"
--         }
--       ],
--       "acceptMarketing": true,
--       "refererId": "Amazon",
--       "disableAllCustomerNotifications": false,
--       "externalFulfillment": false,
--       "pricesIncludeTax": false
--     }
--   ]
-- }

-- Sample code for parsing the JSON response...
-- Use the following online tool to generate parsing code from sample JSON:
-- Generate Parsing Code from JSON

id = ""
subtotal = ""
total_str = ""
giftCardRedemption = ""
totalBeforeGiftCardRedemption = ""
giftCardDoubleSpending = false
usdTotal = ""
tax = ""
paymentMethod = ""
paymentStatus = ""
fulfillmentStatus = ""
vendorOrderNumber = ""
orderNumber = 0
refererUrl = ""
globalReferer = ""
createDate = ""
updateDate = ""
createTimestamp = 0
updateTimestamp = 0
hidden = false
orderComments = ""
privateAdminNotes = ""
email = ""
ipAddress = ""
customerId = 0
customerGroupId = 0
customerGroup = ""
customerTaxExempt = false
customerTaxId = ""
customerTaxIdValid = false
reversedTaxApplied = false
discount = 0
couponDiscount = 0
volumeDiscount = 0
membershipBasedDiscount = 0
totalAndMembershipBasedDiscount = 0
discountCouponId = 0
discountCouponName = ""
discountCouponCode = ""
discountCouponDiscountType = ""
discountCouponStatus = ""
discountCouponDiscount = 0
discountCouponLaunchDate = ""
discountCouponUsesLimit = ""
discountCouponApplicationLimit = ""
discountCouponCreationDate = ""
discountCouponUpdateDate = ""
discountCouponOrderCount = 0
refundedAmount = ""
billingPersonName = ""
billingPersonCompanyName = ""
billingPersonStreet = ""
billingPersonCity = ""
billingPersonCountryCode = ""
billingPersonCountryName = ""
billingPersonPostalCode = ""
billingPersonStateOrProvinceCode = ""
billingPersonStateOrProvinceName = ""
billingPersonPhone = ""
shippingPersonName = ""
shippingPersonCompanyName = ""
shippingPersonStreet = ""
shippingPersonCity = ""
shippingPersonCountryCode = ""
shippingPersonCountryName = ""
shippingPersonPostalCode = ""
shippingPersonStateOrProvinceCode = ""
shippingPersonStateOrProvinceName = ""
shippingPersonPhone = ""
shippingOptionShippingCarrierName = ""
shippingOptionShippingMethodName = ""
shippingOptionShippingRate = ""
shippingOptionEstimatedTransitTime = ""
shippingOptionIsPickup = false
handlingFeeName = ""
handlingFeeValue = 0
handlingFeeDescription = ""
paymentModule = ""
additionalInfoGoogle_customer_id = ""
acceptMarketing = false
refererId = ""
disableAllCustomerNotifications = false
externalFulfillment = false
pricesIncludeTax = false
j = 0
count_j = 0
value = 0
v_type = ""
base = ""
orderTotal = 0
id_int = 0
productId = 0
categoryId = 0
price = 0
productPrice = 0
sku = ""
quantity = 0
shortDescription = ""
shipping = 0
quantityInStock = 0
name = ""
isShippingRequired = false
weight = 0
trackQuantity = false
fixedShippingRateOnly = false
imageUrl = ""
smallThumbnailUrl = ""
hdThumbnailUrl = ""
fixedShippingRate = 0
digital = false
couponApplied = false
dimensionsLength = 0
dimensionsWidth = 0
dimensionsHeight = 0
couponAmount = ""
subscriptionId = 0
recurringChargeSettingsRecurringInterval = ""
recurringChargeSettingsRecurringIntervalCount = 0
k = 0
count_k = 0
value_str = ""
json1 = chilkat.JsonObject.new()
i1 = 0
count_i1 = 0
strVal = ""
selectionTitle = ""
selectionModifier = 0
selectionModifierType = ""
taxOnDiscountedSubtotal = ""
taxOnShipping = 0
includeInPrice = false
discountInfoValue = 0
discountInfoType = ""
discountInfoBase = ""
discountInfoOrderTotal = 0
date = ""
source = ""
reason = ""
amount = ""
length = 0
width = 0
height = 0
weight_str = ""
declaredValue = ""
created = ""
shipToName = ""
shipToCompanyName = ""
shipToStreet = ""
shipToCity = ""
shipToCountryCode = ""
shipToCountryName = ""
shipToPostalCode = ""
shipToStateOrProvinceCode = ""
shipToStateOrProvinceName = ""
shipToPhone = ""
shipFromCompanyName = ""
shipFromStreet = ""
shipFromCity = ""
shipFromCountryCode = ""
shipFromCountryName = ""
shipFromPostalCode = ""
shipFromStateOrProvinceCode = ""
shipFromStateOrProvinceName = ""
shipFromPhone = ""
parcelWeight = ""
parcelWeightUnit = 0
parcelWidth = 0
parcelHeight = 0
parcelLength = 0
parcelDimensionUnit = 0
shippingServiceCarrier = 0
shippingServiceCarrierName = 0
shippingServiceCarrierServiceName = ""
shippingServiceCarrierServiceCode = ""
trackingTracking_number = ""
trackingTracking_url = ""
trackingEstimatedDays = 0
shippingLabelLabel_url = ""
shippingLabelCommercial_invoice_url = ""
customerInputType = ""
title = ""
orderDetailsDisplaySection = ""
orderBy = ""

total = jResp:int_of("total")
count = jResp:int_of("count")
offset = jResp:int_of("offset")
limit = jResp:int_of("limit")
i = 0
count_i = jResp:size_of_array("items")
while i < count_i do
    jResp.i = i
    id = jResp:string_of("items[i].id")
    subtotal = jResp:string_of("items[i].subtotal")
    total_str = jResp:string_of("items[i].total")
    giftCardRedemption = jResp:string_of("items[i].giftCardRedemption")
    totalBeforeGiftCardRedemption = jResp:string_of("items[i].totalBeforeGiftCardRedemption")
    giftCardDoubleSpending = jResp:bool_of("items[i].giftCardDoubleSpending")
    usdTotal = jResp:string_of("items[i].usdTotal")
    tax = jResp:string_of("items[i].tax")
    paymentMethod = jResp:string_of("items[i].paymentMethod")
    paymentStatus = jResp:string_of("items[i].paymentStatus")
    fulfillmentStatus = jResp:string_of("items[i].fulfillmentStatus")
    vendorOrderNumber = jResp:string_of("items[i].vendorOrderNumber")
    orderNumber = jResp:int_of("items[i].orderNumber")
    refererUrl = jResp:string_of("items[i].refererUrl")
    globalReferer = jResp:string_of("items[i].globalReferer")
    createDate = jResp:string_of("items[i].createDate")
    updateDate = jResp:string_of("items[i].updateDate")
    createTimestamp = jResp:int_of("items[i].createTimestamp")
    updateTimestamp = jResp:int_of("items[i].updateTimestamp")
    hidden = jResp:bool_of("items[i].hidden")
    orderComments = jResp:string_of("items[i].orderComments")
    privateAdminNotes = jResp:string_of("items[i].privateAdminNotes")
    email = jResp:string_of("items[i].email")
    ipAddress = jResp:string_of("items[i].ipAddress")
    customerId = jResp:int_of("items[i].customerId")
    customerGroupId = jResp:int_of("items[i].customerGroupId")
    customerGroup = jResp:string_of("items[i].customerGroup")
    customerTaxExempt = jResp:bool_of("items[i].customerTaxExempt")
    customerTaxId = jResp:string_of("items[i].customerTaxId")
    customerTaxIdValid = jResp:bool_of("items[i].customerTaxIdValid")
    reversedTaxApplied = jResp:bool_of("items[i].reversedTaxApplied")
    discount = jResp:int_of("items[i].discount")
    couponDiscount = jResp:int_of("items[i].couponDiscount")
    volumeDiscount = jResp:int_of("items[i].volumeDiscount")
    membershipBasedDiscount = jResp:int_of("items[i].membershipBasedDiscount")
    totalAndMembershipBasedDiscount = jResp:int_of("items[i].totalAndMembershipBasedDiscount")
    discountCouponId = jResp:int_of("items[i].discountCoupon.id")
    discountCouponName = jResp:string_of("items[i].discountCoupon.name")
    discountCouponCode = jResp:string_of("items[i].discountCoupon.code")
    discountCouponDiscountType = jResp:string_of("items[i].discountCoupon.discountType")
    discountCouponStatus = jResp:string_of("items[i].discountCoupon.status")
    discountCouponDiscount = jResp:int_of("items[i].discountCoupon.discount")
    discountCouponLaunchDate = jResp:string_of("items[i].discountCoupon.launchDate")
    discountCouponUsesLimit = jResp:string_of("items[i].discountCoupon.usesLimit")
    discountCouponApplicationLimit = jResp:string_of("items[i].discountCoupon.applicationLimit")
    discountCouponCreationDate = jResp:string_of("items[i].discountCoupon.creationDate")
    discountCouponUpdateDate = jResp:string_of("items[i].discountCoupon.updateDate")
    discountCouponOrderCount = jResp:int_of("items[i].discountCoupon.orderCount")
    refundedAmount = jResp:string_of("items[i].refundedAmount")
    billingPersonName = jResp:string_of("items[i].billingPerson.name")
    billingPersonCompanyName = jResp:string_of("items[i].billingPerson.companyName")
    billingPersonStreet = jResp:string_of("items[i].billingPerson.street")
    billingPersonCity = jResp:string_of("items[i].billingPerson.city")
    billingPersonCountryCode = jResp:string_of("items[i].billingPerson.countryCode")
    billingPersonCountryName = jResp:string_of("items[i].billingPerson.countryName")
    billingPersonPostalCode = jResp:string_of("items[i].billingPerson.postalCode")
    billingPersonStateOrProvinceCode = jResp:string_of("items[i].billingPerson.stateOrProvinceCode")
    billingPersonStateOrProvinceName = jResp:string_of("items[i].billingPerson.stateOrProvinceName")
    billingPersonPhone = jResp:string_of("items[i].billingPerson.phone")
    shippingPersonName = jResp:string_of("items[i].shippingPerson.name")
    shippingPersonCompanyName = jResp:string_of("items[i].shippingPerson.companyName")
    shippingPersonStreet = jResp:string_of("items[i].shippingPerson.street")
    shippingPersonCity = jResp:string_of("items[i].shippingPerson.city")
    shippingPersonCountryCode = jResp:string_of("items[i].shippingPerson.countryCode")
    shippingPersonCountryName = jResp:string_of("items[i].shippingPerson.countryName")
    shippingPersonPostalCode = jResp:string_of("items[i].shippingPerson.postalCode")
    shippingPersonStateOrProvinceCode = jResp:string_of("items[i].shippingPerson.stateOrProvinceCode")
    shippingPersonStateOrProvinceName = jResp:string_of("items[i].shippingPerson.stateOrProvinceName")
    shippingPersonPhone = jResp:string_of("items[i].shippingPerson.phone")
    shippingOptionShippingCarrierName = jResp:string_of("items[i].shippingOption.shippingCarrierName")
    shippingOptionShippingMethodName = jResp:string_of("items[i].shippingOption.shippingMethodName")
    shippingOptionShippingRate = jResp:string_of("items[i].shippingOption.shippingRate")
    shippingOptionEstimatedTransitTime = jResp:string_of("items[i].shippingOption.estimatedTransitTime")
    shippingOptionIsPickup = jResp:bool_of("items[i].shippingOption.isPickup")
    handlingFeeName = jResp:string_of("items[i].handlingFee.name")
    handlingFeeValue = jResp:int_of("items[i].handlingFee.value")
    handlingFeeDescription = jResp:string_of("items[i].handlingFee.description")
    paymentModule = jResp:string_of("items[i].paymentModule")
    additionalInfoGoogle_customer_id = jResp:string_of("items[i].additionalInfo.google_customer_id")
    acceptMarketing = jResp:bool_of("items[i].acceptMarketing")
    refererId = jResp:string_of("items[i].refererId")
    disableAllCustomerNotifications = jResp:bool_of("items[i].disableAllCustomerNotifications")
    externalFulfillment = jResp:bool_of("items[i].externalFulfillment")
    pricesIncludeTax = jResp:bool_of("items[i].pricesIncludeTax")
    j = 0
    count_j = jResp:size_of_array("items[i].customDiscount")
    while j < count_j do
        jResp.j = j
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("items[i].discountInfo")
    while j < count_j do
        jResp.j = j
        value = jResp:int_of("items[i].discountInfo[j].value")
        v_type = jResp:string_of("items[i].discountInfo[j].type")
        base = jResp:string_of("items[i].discountInfo[j].base")
        orderTotal = jResp:int_of("items[i].discountInfo[j].orderTotal")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("items[i].items")
    while j < count_j do
        jResp.j = j
        id_int = jResp:int_of("items[i].items[j].id")
        productId = jResp:int_of("items[i].items[j].productId")
        categoryId = jResp:int_of("items[i].items[j].categoryId")
        price = jResp:int_of("items[i].items[j].price")
        productPrice = jResp:int_of("items[i].items[j].productPrice")
        sku = jResp:string_of("items[i].items[j].sku")
        quantity = jResp:int_of("items[i].items[j].quantity")
        shortDescription = jResp:string_of("items[i].items[j].shortDescription")
        tax = jResp:string_of("items[i].items[j].tax")
        shipping = jResp:int_of("items[i].items[j].shipping")
        quantityInStock = jResp:int_of("items[i].items[j].quantityInStock")
        name = jResp:string_of("items[i].items[j].name")
        isShippingRequired = jResp:bool_of("items[i].items[j].isShippingRequired")
        weight = jResp:int_of("items[i].items[j].weight")
        trackQuantity = jResp:bool_of("items[i].items[j].trackQuantity")
        fixedShippingRateOnly = jResp:bool_of("items[i].items[j].fixedShippingRateOnly")
        imageUrl = jResp:string_of("items[i].items[j].imageUrl")
        smallThumbnailUrl = jResp:string_of("items[i].items[j].smallThumbnailUrl")
        hdThumbnailUrl = jResp:string_of("items[i].items[j].hdThumbnailUrl")
        fixedShippingRate = jResp:int_of("items[i].items[j].fixedShippingRate")
        digital = jResp:bool_of("items[i].items[j].digital")
        couponApplied = jResp:bool_of("items[i].items[j].couponApplied")
        dimensionsLength = jResp:int_of("items[i].items[j].dimensions.length")
        dimensionsWidth = jResp:int_of("items[i].items[j].dimensions.width")
        dimensionsHeight = jResp:int_of("items[i].items[j].dimensions.height")
        couponAmount = jResp:string_of("items[i].items[j].couponAmount")
        subscriptionId = jResp:int_of("items[i].items[j].subscriptionId")
        recurringChargeSettingsRecurringInterval = jResp:string_of("items[i].items[j].recurringChargeSettings.recurringInterval")
        recurringChargeSettingsRecurringIntervalCount = jResp:int_of("items[i].items[j].recurringChargeSettings.recurringIntervalCount")
        k = 0
        count_k = jResp:size_of_array("items[i].items[j].selectedOptions")
        while k < count_k do
            jResp.k = k
            name = jResp:string_of("items[i].items[j].selectedOptions[k].name")
            value_str = jResp:string_of("items[i].items[j].selectedOptions[k].value")
            v_type = jResp:string_of("items[i].items[j].selectedOptions[k].type")
            jResp:object_of2("items[i].items[j].selectedOptions[k]", json1)

            i1 = 0
            count_i1 = json1:size_of_array("valuesArray")
            while i1 < count_i1 do
                json1.i = i1
                strVal = json1:string_of("valuesArray[i]")
                i1 = i1 + 1
            end

            jResp:object_of2("items[i].items[j].selectedOptions[k]", json1)
            i1 = 0
            count_i1 = json1:size_of_array("selections")
            while i1 < count_i1 do
                json1.i = i1
                selectionTitle = json1:string_of("selections[i].selectionTitle")
                selectionModifier = json1:int_of("selections[i].selectionModifier")
                selectionModifierType = json1:string_of("selections[i].selectionModifierType")
                i1 = i1 + 1
            end

            k = k + 1
        end

        k = 0
        count_k = jResp:size_of_array("items[i].items[j].taxes")
        while k < count_k do
            jResp.k = k
            name = jResp:string_of("items[i].items[j].taxes[k].name")
            value = jResp:int_of("items[i].items[j].taxes[k].value")
            total_str = jResp:string_of("items[i].items[j].taxes[k].total")
            taxOnDiscountedSubtotal = jResp:string_of("items[i].items[j].taxes[k].taxOnDiscountedSubtotal")
            taxOnShipping = jResp:int_of("items[i].items[j].taxes[k].taxOnShipping")
            includeInPrice = jResp:bool_of("items[i].items[j].taxes[k].includeInPrice")
            k = k + 1
        end

        k = 0
        count_k = jResp:size_of_array("items[i].items[j].discounts")
        while k < count_k do
            jResp.k = k
            discountInfoValue = jResp:int_of("items[i].items[j].discounts[k].discountInfo.value")
            discountInfoType = jResp:string_of("items[i].items[j].discounts[k].discountInfo.type")
            discountInfoBase = jResp:string_of("items[i].items[j].discounts[k].discountInfo.base")
            discountInfoOrderTotal = jResp:int_of("items[i].items[j].discounts[k].discountInfo.orderTotal")
            total_str = jResp:string_of("items[i].items[j].discounts[k].total")
            k = k + 1
        end

        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("items[i].refunds")
    while j < count_j do
        jResp.j = j
        date = jResp:string_of("items[i].refunds[j].date")
        source = jResp:string_of("items[i].refunds[j].source")
        reason = jResp:string_of("items[i].refunds[j].reason")
        amount = jResp:string_of("items[i].refunds[j].amount")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("items[i].predictedPackage")
    while j < count_j do
        jResp.j = j
        length = jResp:int_of("items[i].predictedPackage[j].length")
        width = jResp:int_of("items[i].predictedPackage[j].width")
        height = jResp:int_of("items[i].predictedPackage[j].height")
        weight_str = jResp:string_of("items[i].predictedPackage[j].weight")
        declaredValue = jResp:string_of("items[i].predictedPackage[j].declaredValue")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("items[i].shipments")
    while j < count_j do
        jResp.j = j
        id = jResp:string_of("items[i].shipments[j].id")
        created = jResp:string_of("items[i].shipments[j].created")
        shipToName = jResp:string_of("items[i].shipments[j].shipTo.name")
        shipToCompanyName = jResp:string_of("items[i].shipments[j].shipTo.companyName")
        shipToStreet = jResp:string_of("items[i].shipments[j].shipTo.street")
        shipToCity = jResp:string_of("items[i].shipments[j].shipTo.city")
        shipToCountryCode = jResp:string_of("items[i].shipments[j].shipTo.countryCode")
        shipToCountryName = jResp:string_of("items[i].shipments[j].shipTo.countryName")
        shipToPostalCode = jResp:string_of("items[i].shipments[j].shipTo.postalCode")
        shipToStateOrProvinceCode = jResp:string_of("items[i].shipments[j].shipTo.stateOrProvinceCode")
        shipToStateOrProvinceName = jResp:string_of("items[i].shipments[j].shipTo.stateOrProvinceName")
        shipToPhone = jResp:string_of("items[i].shipments[j].shipTo.phone")
        shipFromCompanyName = jResp:string_of("items[i].shipments[j].shipFrom.companyName")
        shipFromStreet = jResp:string_of("items[i].shipments[j].shipFrom.street")
        shipFromCity = jResp:string_of("items[i].shipments[j].shipFrom.city")
        shipFromCountryCode = jResp:string_of("items[i].shipments[j].shipFrom.countryCode")
        shipFromCountryName = jResp:string_of("items[i].shipments[j].shipFrom.countryName")
        shipFromPostalCode = jResp:string_of("items[i].shipments[j].shipFrom.postalCode")
        shipFromStateOrProvinceCode = jResp:string_of("items[i].shipments[j].shipFrom.stateOrProvinceCode")
        shipFromStateOrProvinceName = jResp:string_of("items[i].shipments[j].shipFrom.stateOrProvinceName")
        shipFromPhone = jResp:string_of("items[i].shipments[j].shipFrom.phone")
        parcelWeight = jResp:string_of("items[i].shipments[j].parcel.weight")
        parcelWeightUnit = jResp:int_of("items[i].shipments[j].parcel.weightUnit")
        parcelWidth = jResp:int_of("items[i].shipments[j].parcel.width")
        parcelHeight = jResp:int_of("items[i].shipments[j].parcel.height")
        parcelLength = jResp:int_of("items[i].shipments[j].parcel.length")
        parcelDimensionUnit = jResp:int_of("items[i].shipments[j].parcel.dimensionUnit")
        shippingServiceCarrier = jResp:int_of("items[i].shipments[j].shippingService.carrier")
        shippingServiceCarrierName = jResp:int_of("items[i].shipments[j].shippingService.carrierName")
        shippingServiceCarrierServiceName = jResp:string_of("items[i].shipments[j].shippingService.carrierServiceName")
        shippingServiceCarrierServiceCode = jResp:string_of("items[i].shipments[j].shippingService.carrierServiceCode")
        trackingTracking_number = jResp:string_of("items[i].shipments[j].tracking.tracking_number")
        trackingTracking_url = jResp:string_of("items[i].shipments[j].tracking.tracking_url")
        trackingEstimatedDays = jResp:int_of("items[i].shipments[j].tracking.estimatedDays")
        shippingLabelLabel_url = jResp:string_of("items[i].shipments[j].shippingLabel.label_url")
        shippingLabelCommercial_invoice_url = jResp:string_of("items[i].shipments[j].shippingLabel.commercial_invoice_url")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("items[i].taxesOnShipping")
    while j < count_j do
        jResp.j = j
        name = jResp:string_of("items[i].taxesOnShipping[j].name")
        value = jResp:int_of("items[i].taxesOnShipping[j].value")
        total_str = jResp:string_of("items[i].taxesOnShipping[j].total")
        j = j + 1
    end

    j = 0
    count_j = jResp:size_of_array("items[i].orderExtraFields")
    while j < count_j do
        jResp.j = j
        id = jResp:string_of("items[i].orderExtraFields[j].id")
        value_str = jResp:string_of("items[i].orderExtraFields[j].value")
        customerInputType = jResp:string_of("items[i].orderExtraFields[j].customerInputType")
        title = jResp:string_of("items[i].orderExtraFields[j].title")
        orderDetailsDisplaySection = jResp:string_of("items[i].orderExtraFields[j].orderDetailsDisplaySection")
        orderBy = jResp:string_of("items[i].orderExtraFields[j].orderBy")
        j = j + 1
    end

    i = i + 1
end