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

PowerBuilder 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
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
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
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
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

 

 

 

(PowerBuilder) Walmart - Acknowledge Order

See Acknowledge Orders for more information about this call.

Acknowledges an entire order, including all of its order lines. Walmart requires a seller to acknowledge orders within four hours of receipt of the order, except in extenuating circumstances.

The response to a successful call contains the acknowledged order.

In general, only orders that are in a “Created” state should be acknowledged. As a good practice, acknowledge your orders to avoid underselling. Orders that are in an “Acknowledged” state can be re-acknowledged, possibly in response to an error response from an earlier call to acknowledge order. Orders with line items that are shipped or canceled should not be re-acknowledged.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_SbUrl
integer li_Success
integer li_NumReplaced
string ls_RequestMethod
oleobject loo_AuthUtil
string ls_WmConsumerId
string ls_WmPrivateKey
string ls_JsonStr
oleobject loo_Json
oleobject loo_Http
oleobject loo_Resp
oleobject loo_SbBody
string ls_OrderPurchaseOrderId
string ls_OrderCustomerOrderId
string ls_OrderCustomerEmailId
integer li_OrderOrderDate
string ls_OrderShippingInfoPhone
integer li_OrderShippingInfoEstimatedDeliveryDate
integer li_OrderShippingInfoEstimatedShipDate
string ls_OrderShippingInfoMethodCode
string ls_OrderShippingInfoPostalAddressName
string ls_OrderShippingInfoPostalAddressAddress1
string ls_OrderShippingInfoPostalAddressAddress2
string ls_OrderShippingInfoPostalAddressCity
string ls_OrderShippingInfoPostalAddressState
string ls_OrderShippingInfoPostalAddressPostalCode
string ls_OrderShippingInfoPostalAddressCountry
string ls_OrderShippingInfoPostalAddressAddressType
integer i
integer li_Count_i
string ls_LineNumber
string ls_ItemProductName
string ls_ItemSku
string ls_OrderLineQuantityUnitOfMeasurement
string ls_OrderLineQuantityAmount
integer li_StatusDate
integer li_RefundRefundId
integer li_RefundRefundComments
integer j
integer li_Count_j
string ls_ChargeType
string ls_ChargeName
string ls_ChargeAmountCurrency
integer li_ChargeAmountAmount
string ls_TaxTaxName
string ls_TaxTaxAmountCurrency
integer li_TaxTaxAmountAmount
string ls_Status
string ls_StatusQuantityUnitOfMeasurement
string ls_StatusQuantityAmount
integer li_CancellationReason
integer li_TrackingInfoShipDateTime
integer li_TrackingInfoCarrierNameOtherCarrier
string ls_TrackingInfoCarrierNameCarrier
string ls_TrackingInfoMethodCode
string ls_TrackingInfoTrackingNumber
string ls_TrackingInfoTrackingURL
string ls_RefundReason
string ls_ChargeChargeType
string ls_ChargeChargeName
string ls_ChargeChargeAmountCurrency
integer li_ChargeChargeAmountAmount
integer li_ChargeTax

// ---------------------------------------------------------------------------------------------------------
// Note: This example is deprecated.  The Walmart API no longer uses the Signature method of authenticating.
// Walmart now uses OAuth2.  
// ---------------------------------------------------------------------------------------------------------

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

// Sends the following POST request:
// POST https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/acknowledge

loo_SbUrl = create oleobject
li_rc = loo_SbUrl.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
if li_rc < 0 then
    destroy loo_SbUrl
    MessageBox("Error","Connecting to COM object failed")
    return
end if
li_Success = loo_SbUrl.Append("https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/acknowledge")
li_NumReplaced = loo_SbUrl.Replace("{purchaseOrderId}","1111691995111")

ls_RequestMethod = "POST"

// First we need to generate a signature for our request.
// The signature needs to be re-generated for each new Walmart HTTP request.
loo_AuthUtil = create oleobject
li_rc = loo_AuthUtil.ConnectToNewObject("Chilkat_9_5_0.AuthUtil")

ls_WmConsumerId = "WALMART_CONSUMER_ID"
ls_WmPrivateKey = "WALMART_PRIVATE_KEY"
ls_JsonStr = loo_AuthUtil.WalmartSignature(loo_SbUrl.GetAsString(),ls_WmConsumerId,ls_WmPrivateKey,ls_RequestMethod)
if loo_AuthUtil.LastMethodSuccess <> 1 then
    Write-Debug loo_AuthUtil.LastErrorText
    destroy loo_SbUrl
    destroy loo_AuthUtil
    return
end if

// The JSON returned by WalmartSignature contains the values to be used in the following
// header fields: WM_SEC.AUTH_SIGNATURE, WM_SEC.TIMESTAMP, and WM_QOS.CORRELATION_ID
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_Json.Load(ls_JsonStr)

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")

loo_Http.SetRequestHeader("WM_SVC.NAME","Walmart Marketplace")
loo_Http.SetRequestHeader("WM_QOS.CORRELATION_ID",loo_Json.StringOf("correlation_id"))
loo_Http.SetRequestHeader("WM_SEC.TIMESTAMP",loo_Json.StringOf("timestamp"))
loo_Http.SetRequestHeader("WM_SEC.AUTH_SIGNATURE",loo_Json.StringOf("signature"))
loo_Http.SetRequestHeader("WM_CONSUMER.ID",ls_WmConsumerId)
// Note: Make sure to replace "WALMART_CHANNEL_TYPE" with the actual value for your seller account...
loo_Http.SetRequestHeader("WM_CONSUMER.CHANNEL.TYPE","WALMART_CHANNEL_TYPE")
loo_Http.Accept = "application/xml"

// Note: Do not explicitly set the "Host" header.  Chilkat will set it automatically.

// Walmart provides the option to send/receive JSON or XML.  This example will use JSON.
// Note: Please see the online JSON/XML code generation tools at https://tools.chilkat.io/
// The online tools generate code to create/parse XML or JSON.  (You copy sample JSON/XML into the online format,
// and generate code in your selected programming language.  It's a big time saver.)

loo_Http.SetRequestHeader("Accept","application/json")
// The body of this particular POST request contains just "{}". (The order ID is already in the URL path.)
loo_Resp = loo_Http.PostJson2(loo_SbUrl.GetAsString(),"application/json","{}")
if loo_Http.LastMethodSuccess <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_SbUrl
    destroy loo_AuthUtil
    destroy loo_Json
    destroy loo_Http
    return
end if

// Get the JSON response body, which could contain an error, or if successful contains
// the acknowledged order.
loo_SbBody = create oleobject
li_rc = loo_SbBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_Resp.GetBodySb(loo_SbBody)

// A successful response should have a 200 response status
if loo_Resp.StatusCode <> 200 then
    Write-Debug loo_SbBody.GetAsString()
    Write-Debug "Response Status Code: " + string(loo_Resp.StatusCode)
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_SbUrl
    destroy loo_AuthUtil
    destroy loo_Json
    destroy loo_Http
    destroy loo_SbBody
    return
end if

destroy loo_Resp

// Parse the JSON response.
// A sample response is shown below this code.  (The online tools at https://tools.chilkat.io were used to generate the 
// fragment of code below using the sample response data at 
// https://developer.walmart.com/#/apicenter/marketPlace/latest?country=us#acknowledgingOrders

loo_Json.LoadSb(loo_SbBody)

ls_OrderPurchaseOrderId = loo_Json.StringOf("order.purchaseOrderId")
ls_OrderCustomerOrderId = loo_Json.StringOf("order.customerOrderId")
ls_OrderCustomerEmailId = loo_Json.StringOf("order.customerEmailId")
li_OrderOrderDate = loo_Json.IntOf("order.orderDate")
ls_OrderShippingInfoPhone = loo_Json.StringOf("order.shippingInfo.phone")
li_OrderShippingInfoEstimatedDeliveryDate = loo_Json.IntOf("order.shippingInfo.estimatedDeliveryDate")
li_OrderShippingInfoEstimatedShipDate = loo_Json.IntOf("order.shippingInfo.estimatedShipDate")
ls_OrderShippingInfoMethodCode = loo_Json.StringOf("order.shippingInfo.methodCode")
ls_OrderShippingInfoPostalAddressName = loo_Json.StringOf("order.shippingInfo.postalAddress.name")
ls_OrderShippingInfoPostalAddressAddress1 = loo_Json.StringOf("order.shippingInfo.postalAddress.address1")
ls_OrderShippingInfoPostalAddressAddress2 = loo_Json.StringOf("order.shippingInfo.postalAddress.address2")
ls_OrderShippingInfoPostalAddressCity = loo_Json.StringOf("order.shippingInfo.postalAddress.city")
ls_OrderShippingInfoPostalAddressState = loo_Json.StringOf("order.shippingInfo.postalAddress.state")
ls_OrderShippingInfoPostalAddressPostalCode = loo_Json.StringOf("order.shippingInfo.postalAddress.postalCode")
ls_OrderShippingInfoPostalAddressCountry = loo_Json.StringOf("order.shippingInfo.postalAddress.country")
ls_OrderShippingInfoPostalAddressAddressType = loo_Json.StringOf("order.shippingInfo.postalAddress.addressType")
i = 0
li_Count_i = loo_Json.SizeOfArray("order.orderLines.orderLine")
do while i < li_Count_i
    loo_Json.I = i
    ls_LineNumber = loo_Json.StringOf("order.orderLines.orderLine[i].lineNumber")
    ls_ItemProductName = loo_Json.StringOf("order.orderLines.orderLine[i].item.productName")
    ls_ItemSku = loo_Json.StringOf("order.orderLines.orderLine[i].item.sku")
    ls_OrderLineQuantityUnitOfMeasurement = loo_Json.StringOf("order.orderLines.orderLine[i].orderLineQuantity.unitOfMeasurement")
    ls_OrderLineQuantityAmount = loo_Json.StringOf("order.orderLines.orderLine[i].orderLineQuantity.amount")
    li_StatusDate = loo_Json.IntOf("order.orderLines.orderLine[i].statusDate")
    li_RefundRefundId = loo_Json.IsNullOf("order.orderLines.orderLine[i].refund.refundId")
    li_RefundRefundComments = loo_Json.IsNullOf("order.orderLines.orderLine[i].refund.refundComments")
    j = 0
    li_Count_j = loo_Json.SizeOfArray("order.orderLines.orderLine[i].charges.charge")
    do while j < li_Count_j
        loo_Json.J = j
        ls_ChargeType = loo_Json.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeType")
        ls_ChargeName = loo_Json.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeName")
        ls_ChargeAmountCurrency = loo_Json.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.currency")
        li_ChargeAmountAmount = loo_Json.IntOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.amount")
        ls_TaxTaxName = loo_Json.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxName")
        ls_TaxTaxAmountCurrency = loo_Json.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.currency")
        li_TaxTaxAmountAmount = loo_Json.IntOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.amount")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_Json.SizeOfArray("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus")
    do while j < li_Count_j
        loo_Json.J = j
        ls_Status = loo_Json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status")
        ls_StatusQuantityUnitOfMeasurement = loo_Json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement")
        ls_StatusQuantityAmount = loo_Json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount")
        li_CancellationReason = loo_Json.IsNullOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].cancellationReason")
        li_TrackingInfoShipDateTime = loo_Json.IntOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime")
        li_TrackingInfoCarrierNameOtherCarrier = loo_Json.IsNullOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.otherCarrier")
        ls_TrackingInfoCarrierNameCarrier = loo_Json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier")
        ls_TrackingInfoMethodCode = loo_Json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode")
        ls_TrackingInfoTrackingNumber = loo_Json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber")
        ls_TrackingInfoTrackingURL = loo_Json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_Json.SizeOfArray("order.orderLines.orderLine[i].refund.refundCharges.refundCharge")
    do while j < li_Count_j
        loo_Json.J = j
        ls_RefundReason = loo_Json.StringOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].refundReason")
        ls_ChargeChargeType = loo_Json.StringOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.chargeType")
        ls_ChargeChargeName = loo_Json.StringOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.chargeName")
        ls_ChargeChargeAmountCurrency = loo_Json.StringOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.chargeAmount.currency")
        li_ChargeChargeAmountAmount = loo_Json.IntOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.chargeAmount.amount")
        li_ChargeTax = loo_Json.IsNullOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.tax")
        j = j + 1
    loop
    i = i + 1
loop

Write-Debug "Success!"

// Sample Walmart Order Acknowledge Response:

// {
//   "order": {
//     "purchaseOrderId": "1577684050862",
//     "customerOrderId": "2861700797280",
//     "customerEmailId": "jsanthanam@walmartlabs.com",
//     "orderDate": 1484458949000,
//     "shippingInfo": {
//       "phone": "4151234567",
//       "estimatedDeliveryDate": 1485586800000,
//       "estimatedShipDate": 1484636400000,
//       "methodCode": "Value",
//       "postalAddress": {
//         "name": "Asha  Chakre",
//         "address1": "860 W California ave",
//         "address2": null,
//         "city": "Sunnyvale",
//         "state": "CA",
//         "postalCode": "94086",
//         "country": "USA",
//         "addressType": "RESIDENTIAL"
//       }
//     },
//     "orderLines": {
//       "orderLine": [
//         {
//           "lineNumber": "1",
//           "item": {
//             "productName": "Kellogg's Rice Krispies Cereal, 24 oz",
//             "sku": "MGR_07_21_00100123"
//           },
//           "charges": {
//             "charge": [
//               {
//                 "chargeType": "PRODUCT",
//                 "chargeName": "ItemPrice",
//                 "chargeAmount": {
//                   "currency": "USD",
//                   "amount": 19.99
//                 },
//                 "tax": {
//                   "taxName": "Tax1",
//                   "taxAmount": {
//                     "currency": "USD",
//                     "amount": 1.7
//                   }
//                 }
//               }
//             ]
//           },
//           "orderLineQuantity": {
//             "unitOfMeasurement": "EACH",
//             "amount": "1"
//           },
//           "statusDate": 1487888747000,
//           "orderLineStatuses": {
//             "orderLineStatus": [
//               {
//                 "status": "Shipped",
//                 "statusQuantity": {
//                   "unitOfMeasurement": "EACH",
//                   "amount": "1"
//                 },
//                 "cancellationReason": null,
//                 "trackingInfo": {
//                   "shipDateTime": 1485549015000,
//                   "carrierName": {
//                     "otherCarrier": null,
//                     "carrier": "FedEx"
//                   },
//                   "methodCode": "Value",
//                   "trackingNumber": "3445435443441221",
//                   "trackingURL": "http://walmart.narvar.com/walmart/tracking/Fedex?&type=MP&seller_id=801&promise_date=01/28/2017&dzip=94086&tracking_numbers=3445435443441221"
//                 }
//               }
//             ]
//           },
//           "refund": {
//             "refundId": null,
//             "refundComments": null,
//             "refundCharges": {
//               "refundCharge": [
//                 {
//                   "refundReason": "ItemNotReceivedByCustomer",
//                   "charge": {
//                     "chargeType": "PRODUCT",
//                     "chargeName": "Lost in Transit",
//                     "chargeAmount": {
//                       "currency": "USD",
//                       "amount": -0.01
//                     },
//                     "tax": null
//                   }
//                 }
//               ]
//             }
//           }
//         }
//       ]
//     }
//   }
// }


destroy loo_SbUrl
destroy loo_AuthUtil
destroy loo_Json
destroy loo_Http
destroy loo_SbBody

 

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