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

Visual FoxPro 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
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

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
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
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

 

 

 

(Visual FoxPro) 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

LOCAL loSbUrl
LOCAL lnSuccess
LOCAL lnNumReplaced
LOCAL lcRequestMethod
LOCAL loAuthUtil
LOCAL lcWmConsumerId
LOCAL lcWmPrivateKey
LOCAL lcJsonStr
LOCAL loJson
LOCAL loHttp
LOCAL loResp
LOCAL loSbBody
LOCAL lcOrderPurchaseOrderId
LOCAL lcOrderCustomerOrderId
LOCAL lcOrderCustomerEmailId
LOCAL lnOrderOrderDate
LOCAL lcOrderShippingInfoPhone
LOCAL lnOrderShippingInfoEstimatedDeliveryDate
LOCAL lnOrderShippingInfoEstimatedShipDate
LOCAL lcOrderShippingInfoMethodCode
LOCAL lcOrderShippingInfoPostalAddressName
LOCAL lcOrderShippingInfoPostalAddressAddress1
LOCAL lcOrderShippingInfoPostalAddressAddress2
LOCAL lcOrderShippingInfoPostalAddressCity
LOCAL lcOrderShippingInfoPostalAddressState
LOCAL lcOrderShippingInfoPostalAddressPostalCode
LOCAL lcOrderShippingInfoPostalAddressCountry
LOCAL lcOrderShippingInfoPostalAddressAddressType
LOCAL i
LOCAL lnCount_i
LOCAL lcLineNumber
LOCAL lcItemProductName
LOCAL lcItemSku
LOCAL lcOrderLineQuantityUnitOfMeasurement
LOCAL lcOrderLineQuantityAmount
LOCAL lnStatusDate
LOCAL lnRefundRefundId
LOCAL lnRefundRefundComments
LOCAL j
LOCAL lnCount_j
LOCAL lcChargeType
LOCAL lcChargeName
LOCAL lcChargeAmountCurrency
LOCAL lnChargeAmountAmount
LOCAL lcTaxTaxName
LOCAL lcTaxTaxAmountCurrency
LOCAL lnTaxTaxAmountAmount
LOCAL lcStatus
LOCAL lcStatusQuantityUnitOfMeasurement
LOCAL lcStatusQuantityAmount
LOCAL lnCancellationReason
LOCAL lnTrackingInfoShipDateTime
LOCAL lnTrackingInfoCarrierNameOtherCarrier
LOCAL lcTrackingInfoCarrierNameCarrier
LOCAL lcTrackingInfoMethodCode
LOCAL lcTrackingInfoTrackingNumber
LOCAL lcTrackingInfoTrackingURL
LOCAL lcRefundReason
LOCAL lcChargeChargeType
LOCAL lcChargeChargeName
LOCAL lcChargeChargeAmountCurrency
LOCAL lnChargeChargeAmountAmount
LOCAL lnChargeTax

* ---------------------------------------------------------------------------------------------------------
* 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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbUrl = CreateObject('Chilkat.StringBuilder')
lnSuccess = loSbUrl.Append("https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/acknowledge")
lnNumReplaced = loSbUrl.Replace("{purchaseOrderId}","1111691995111")

lcRequestMethod = "POST"

* First we need to generate a signature for our request.
* The signature needs to be re-generated for each new Walmart HTTP request.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.AuthUtil')
loAuthUtil = CreateObject('Chilkat.AuthUtil')

lcWmConsumerId = "WALMART_CONSUMER_ID"
lcWmPrivateKey = "WALMART_PRIVATE_KEY"
lcJsonStr = loAuthUtil.WalmartSignature(loSbUrl.GetAsString(),lcWmConsumerId,lcWmPrivateKey,lcRequestMethod)
IF (loAuthUtil.LastMethodSuccess <> 1) THEN
    ? loAuthUtil.LastErrorText
    RELEASE loSbUrl
    RELEASE loAuthUtil
    CANCEL
ENDIF

* 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
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJson = CreateObject('Chilkat.JsonObject')
loJson.Load(lcJsonStr)

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
loHttp.SetRequestHeader("WM_SVC.NAME","Walmart Marketplace")
loHttp.SetRequestHeader("WM_QOS.CORRELATION_ID",loJson.StringOf("correlation_id"))
loHttp.SetRequestHeader("WM_SEC.TIMESTAMP",loJson.StringOf("timestamp"))
loHttp.SetRequestHeader("WM_SEC.AUTH_SIGNATURE",loJson.StringOf("signature"))
loHttp.SetRequestHeader("WM_CONSUMER.ID",lcWmConsumerId)
* Note: Make sure to replace "WALMART_CHANNEL_TYPE" with the actual value for your seller account...
loHttp.SetRequestHeader("WM_CONSUMER.CHANNEL.TYPE","WALMART_CHANNEL_TYPE")
loHttp.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.)

loHttp.SetRequestHeader("Accept","application/json")
* The body of this particular POST request contains just "{}". (The order ID is already in the URL path.)
loResp = loHttp.PostJson2(loSbUrl.GetAsString(),"application/json","{}")
IF (loHttp.LastMethodSuccess <> 1) THEN
    ? loHttp.LastErrorText
    RELEASE loSbUrl
    RELEASE loAuthUtil
    RELEASE loJson
    RELEASE loHttp
    CANCEL
ENDIF

* Get the JSON response body, which could contain an error, or if successful contains
* the acknowledged order.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbBody)

* A successful response should have a 200 response status
IF (loResp.StatusCode <> 200) THEN
    ? loSbBody.GetAsString()
    ? "Response Status Code: " + STR(loResp.StatusCode)
    ? "Failed."
    RELEASE loResp
    RELEASE loSbUrl
    RELEASE loAuthUtil
    RELEASE loJson
    RELEASE loHttp
    RELEASE loSbBody
    CANCEL
ENDIF

RELEASE loResp

* 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

loJson.LoadSb(loSbBody)

lcOrderPurchaseOrderId = loJson.StringOf("order.purchaseOrderId")
lcOrderCustomerOrderId = loJson.StringOf("order.customerOrderId")
lcOrderCustomerEmailId = loJson.StringOf("order.customerEmailId")
lnOrderOrderDate = loJson.IntOf("order.orderDate")
lcOrderShippingInfoPhone = loJson.StringOf("order.shippingInfo.phone")
lnOrderShippingInfoEstimatedDeliveryDate = loJson.IntOf("order.shippingInfo.estimatedDeliveryDate")
lnOrderShippingInfoEstimatedShipDate = loJson.IntOf("order.shippingInfo.estimatedShipDate")
lcOrderShippingInfoMethodCode = loJson.StringOf("order.shippingInfo.methodCode")
lcOrderShippingInfoPostalAddressName = loJson.StringOf("order.shippingInfo.postalAddress.name")
lcOrderShippingInfoPostalAddressAddress1 = loJson.StringOf("order.shippingInfo.postalAddress.address1")
lcOrderShippingInfoPostalAddressAddress2 = loJson.StringOf("order.shippingInfo.postalAddress.address2")
lcOrderShippingInfoPostalAddressCity = loJson.StringOf("order.shippingInfo.postalAddress.city")
lcOrderShippingInfoPostalAddressState = loJson.StringOf("order.shippingInfo.postalAddress.state")
lcOrderShippingInfoPostalAddressPostalCode = loJson.StringOf("order.shippingInfo.postalAddress.postalCode")
lcOrderShippingInfoPostalAddressCountry = loJson.StringOf("order.shippingInfo.postalAddress.country")
lcOrderShippingInfoPostalAddressAddressType = loJson.StringOf("order.shippingInfo.postalAddress.addressType")
i = 0
lnCount_i = loJson.SizeOfArray("order.orderLines.orderLine")
DO WHILE i < lnCount_i
    loJson.I = i
    lcLineNumber = loJson.StringOf("order.orderLines.orderLine[i].lineNumber")
    lcItemProductName = loJson.StringOf("order.orderLines.orderLine[i].item.productName")
    lcItemSku = loJson.StringOf("order.orderLines.orderLine[i].item.sku")
    lcOrderLineQuantityUnitOfMeasurement = loJson.StringOf("order.orderLines.orderLine[i].orderLineQuantity.unitOfMeasurement")
    lcOrderLineQuantityAmount = loJson.StringOf("order.orderLines.orderLine[i].orderLineQuantity.amount")
    lnStatusDate = loJson.IntOf("order.orderLines.orderLine[i].statusDate")
    lnRefundRefundId = loJson.IsNullOf("order.orderLines.orderLine[i].refund.refundId")
    lnRefundRefundComments = loJson.IsNullOf("order.orderLines.orderLine[i].refund.refundComments")
    j = 0
    lnCount_j = loJson.SizeOfArray("order.orderLines.orderLine[i].charges.charge")
    DO WHILE j < lnCount_j
        loJson.J = j
        lcChargeType = loJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeType")
        lcChargeName = loJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeName")
        lcChargeAmountCurrency = loJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.currency")
        lnChargeAmountAmount = loJson.IntOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.amount")
        lcTaxTaxName = loJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxName")
        lcTaxTaxAmountCurrency = loJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.currency")
        lnTaxTaxAmountAmount = loJson.IntOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.amount")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJson.SizeOfArray("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus")
    DO WHILE j < lnCount_j
        loJson.J = j
        lcStatus = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status")
        lcStatusQuantityUnitOfMeasurement = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement")
        lcStatusQuantityAmount = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount")
        lnCancellationReason = loJson.IsNullOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].cancellationReason")
        lnTrackingInfoShipDateTime = loJson.IntOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime")
        lnTrackingInfoCarrierNameOtherCarrier = loJson.IsNullOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.otherCarrier")
        lcTrackingInfoCarrierNameCarrier = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier")
        lcTrackingInfoMethodCode = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode")
        lcTrackingInfoTrackingNumber = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber")
        lcTrackingInfoTrackingURL = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJson.SizeOfArray("order.orderLines.orderLine[i].refund.refundCharges.refundCharge")
    DO WHILE j < lnCount_j
        loJson.J = j
        lcRefundReason = loJson.StringOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].refundReason")
        lcChargeChargeType = loJson.StringOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.chargeType")
        lcChargeChargeName = loJson.StringOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.chargeName")
        lcChargeChargeAmountCurrency = loJson.StringOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.chargeAmount.currency")
        lnChargeChargeAmountAmount = loJson.IntOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.chargeAmount.amount")
        lnChargeTax = loJson.IsNullOf("order.orderLines.orderLine[i].refund.refundCharges.refundCharge[j].charge.tax")
        j = j + 1
    ENDDO
    i = i + 1
ENDDO

? "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
*                   }
*                 }
*               ]
*             }
*           }
*         }
*       ]
*     }
*   }
* }

RELEASE loSbUrl
RELEASE loAuthUtil
RELEASE loJson
RELEASE loHttp
RELEASE loSbBody


 

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