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

Walmart v3 Acknowledge Orders

See more Walmart v3 Examples

Allows a DSV to acknowledge an order, including all order lines, preferably within four hours of receipt of the order.

The response to a successful call contains the acknowledged order. As a good practice, acknowledge your orders to avoid underselling.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkStringBuilder.pb"

Procedure ChilkatExample()

    success.i = 0

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

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkHttp::ckSetRequestHeader(http,"WM_QOS.CORRELATION_ID","b3261d2d-028a-4ef7-8602-633c23200af6")
    CkHttp::ckSetRequestHeader(http,"WM_SEC.ACCESS_TOKEN","eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....")
    CkHttp::ckSetRequestHeader(http,"Accept","application/json")
    CkHttp::ckSetRequestHeader(http,"WM_SVC.NAME","Walmart Marketplace")

    resp.i = CkHttpResponse::ckCreate()
    If resp.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success = CkHttp::ckHttpNoBody(http,"POST","https://api-gateway.walmart.com/v3/orders/{purchaseOrderId}/acknowledge",resp)
    If success = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkHttpResponse::ckDispose(resp)
        ProcedureReturn
    EndIf

    Debug "Response status code: " + Str(CkHttpResponse::ckStatusCode(resp))

    sbResponseBody.i = CkStringBuilder::ckCreate()
    If sbResponseBody.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkHttpResponse::ckGetBodySb(resp,sbResponseBody)

    ;  A sample JSON response:

    ;  {
    ;    "order": {
    ;      "purchaseOrderId": "1581564396843",
    ;      "customerOrderId": "3001859598500",
    ;      "customerEmailId": "D5AFD31C627A45F3A93041FD557F94C4@relay.walmart.com",
    ;      "orderDate": 1517252660000,
    ;      "buyerId": "43538435-de77-44c7-b606-ad9a8ff1d8f8",
    ;      "mart": "Walmart.com",
    ;      "isGuest": false,
    ;      "shippingInfo": {
    ;        "phone": "2566519197",
    ;        "estimatedDeliveryDate": 1518454800000,
    ;        "estimatedShipDate": 1518109200000,
    ;        "methodCode": "Standard",
    ;        "postalAddress": {
    ;          "name": "whitney feathers",
    ;          "address1": "4100 Cloverdale Dr NW",
    ;          "address2": null,
    ;          "city": "Huntsville",
    ;          "state": "AL",
    ;          "postalCode": "35805",
    ;          "country": "USA",
    ;          "addressType": "RESIDENTIAL"
    ;        }
    ;      },
    ;      "orderLines": {
    ;        "orderLine": [
    ;          {
    ;            "lineNumber": "1",
    ;            "item": {
    ;              "productName": "High-Quality 8 x 10 Prints",
    ;              "sku": "8x10{IS",
    ;              "imageUrl": "https://i5.walmartimages.com/asr/7924b94b-49fa-4050-8e62-2364d07d0068_1.6ef0f115abba4f27b7c5e785c2bac517.jpeg",
    ;              "weight": {
    ;                "value": "0.438",
    ;                "unit": "Pounds"
    ;              }
    ;            },
    ;            "charges": {
    ;              "charge": [
    ;                {
    ;                  "chargeType": "PRODUCT",
    ;                  "chargeName": "ItemPrice",
    ;                  "chargeAmount": {
    ;                    "currency": "USD",
    ;                    "amount": 1.79
    ;                  },
    ;                  "tax": {
    ;                    "taxName": "Tax1",
    ;                    "taxAmount": {
    ;                      "currency": "USD",
    ;                      "amount": 0.15
    ;                    }
    ;                  }
    ;                },
    ;                {
    ;                  "chargeType": "SHIPPING",
    ;                  "chargeName": "Shipping",
    ;                  "chargeAmount": {
    ;                    "currency": "USD",
    ;                    "amount": 1.75
    ;                  },
    ;                  "tax": null
    ;                }
    ;              ]
    ;            },
    ;            "orderLineQuantity": {
    ;              "unitOfMeasurement": "EACH",
    ;              "amount": "1"
    ;            },
    ;            "statusDate": 1542069814000,
    ;            "orderLineStatuses": {
    ;              "orderLineStatus": [
    ;                {
    ;                  "status": "Shipped",
    ;                  "statusQuantity": {
    ;                    "unitOfMeasurement": "EACH",
    ;                    "amount": "1"
    ;                  },
    ;                  "cancellationReason": null,
    ;                  "trackingInfo": {
    ;                    "shipDateTime": 1540845015000,
    ;                    "carrierName": {
    ;                      "otherCarrier": null,
    ;                      "carrier": "UPS"
    ;                    },
    ;                    "methodCode": "Standard",
    ;                    "carrierMethodCode": null,
    ;                    "trackingNumber": "3445435443441221",
    ;                    "trackingURL": "http://www.fedex.com"
    ;                  }
    ;                }
    ;              ]
    ;            },
    ;            "refund": {
    ;              "refundId": null,
    ;              "refundComments": null,
    ;              "refundCharges": {
    ;                "refundCharge": [
    ;                  {
    ;                    "refundReason": "Quality -> Missing Parts / Instructions",
    ;                    "charge": {
    ;                      "chargeType": "PRODUCT",
    ;                      "chargeName": "Quality -> Missing Parts / Instructions",
    ;                      "chargeAmount": {
    ;                        "currency": "USD",
    ;                        "amount": -0.01
    ;                      },
    ;                      "tax": null
    ;                    }
    ;                  }
    ;                ]
    ;              }
    ;            },
    ;            "originalCarrierMethod": "22",
    ;            "referenceLineId": "123456",
    ;            "fulfillment": {
    ;              "fulfillmentOption": "S2H",
    ;              "shipMethod": "STANDARD",
    ;              "storeId": null,
    ;              "pickUpDateTime": 1518120000000,
    ;              "pickUpBy": null
    ;            }
    ;          }
    ;        ]
    ;      }
    ;    }
    ;  }


    CkHttp::ckDispose(http)
    CkHttpResponse::ckDispose(resp)
    CkStringBuilder::ckDispose(sbResponseBody)


    ProcedureReturn
EndProcedure