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

Node.js 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
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

 

 

 

(Node.js) Walmart v3 Ship Order Lines

See more Walmart v3 Examples

Updates the status of order lines to Shipped and trigger the charge to the customer. The response to a successful call contains the order with the shipped line items.

For more information, see https://developer.walmart.com/api/us/mp/orders#operation/shippingUpdates

Install Chilkat for Node.js and Electron using npm at

Chilkat npm packages for Node.js

Chilkat npm packages for Electron

on Windows, Linux, MacOSX, and ARM

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}

function chilkatExample() {

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

    var http = new chilkat.Http();
    var success;

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

    // Send the following in the request body:

    // {
    //   "orderShipment": {
    //     "orderLines": {
    //       "orderLine": [
    //         {
    //           "lineNumber": "1",
    //           "intentToCancelOverride": false,
    //           "sellerOrderId": "92344",
    //           "orderLineStatuses": {
    //             "orderLineStatus": [
    //               {
    //                 "status": "Shipped",
    //                 "statusQuantity": {
    //                   "unitOfMeasurement": "EACH",
    //                   "amount": "1"
    //                 },
    //                 "trackingInfo": {
    //                   "shipDateTime": 1580821866000,
    //                   "carrierName": {
    //                     "carrier": "UPS"
    //                   },
    //                   "methodCode": "Standard",
    //                   "trackingNumber": "22344",
    //                   "trackingURL": "http://walmart/tracking/ups?&type=MP&seller_id=12345&promise_date=03/02/2020&dzip=92840&tracking_numbers=92345"
    //                 },
    //                 "returnCenterAddress": {
    //                   "name": "walmart",
    //                   "address1": "walmart store 2",
    //                   "city": "Huntsville",
    //                   "state": "AL",
    //                   "postalCode": "35805",
    //                   "country": "USA",
    //                   "dayPhone": "12344",
    //                   "emailId": "walmart@walmart.com"
    //                 }
    //               }
    //             ]
    //           }
    //         },
    //         {
    //           "lineNumber": "2",
    //           "sellerOrderId": "92344",
    //           "orderLineStatuses": {
    //             "orderLineStatus": [
    //               {
    //                 "status": "Shipped",
    //                 "statusQuantity": {
    //                   "unitOfMeasurement": "EACH",
    //                   "amount": "1"
    //                 },
    //                 "trackingInfo": {
    //                   "shipDateTime": 1580821866000,
    //                   "carrierName": {
    //                     "carrier": "FedEx"
    //                   },
    //                   "methodCode": "Express",
    //                   "trackingNumber": "22344",
    //                   "trackingURL": "http://walmart/tracking/fedEx?&type=MP&seller_id=12345&promise_date=03/02/2020&dzip=92840&tracking_numbers=92344"
    //                 },
    //                 "returnCenterAddress": {
    //                   "name": "walmart",
    //                   "address1": "walmart store 2",
    //                   "city": "Huntsville",
    //                   "state": "AL",
    //                   "postalCode": "35805",
    //                   "country": "USA",
    //                   "dayPhone": "12344",
    //                   "emailId": "walmart@walmart.com"
    //                 }
    //               }
    //             ]
    //           }
    //         }
    //       ]
    //     }
    //   }
    // }

    var json = new chilkat.JsonObject();
    var orderLineIndex = 0;
    var statusIndex = 0;
    json.I = orderLineIndex;
    json.J = statusIndex;
    json.UpdateString("orderShipment.orderLines.orderLine[i].lineNumber","1");
    json.UpdateBool("orderShipment.orderLines.orderLine[i].intentToCancelOverride",false);
    json.UpdateString("orderShipment.orderLines.orderLine[i].sellerOrderId","92344");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status","Shipped");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement","EACH");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount","1");
    json.UpdateInt("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime",123);
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier","UPS");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode","Standard");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber","22344");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL","http://walmart/tracking/ups?&type=MP&seller_id=12345&promise_date=03/02/2020&dzip=92840&tracking_numbers=92345");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name","walmart");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1","walmart store 2");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city","Huntsville");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state","AL");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode","35805");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country","USA");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone","12344");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId","walmart@walmart.com");

    orderLineIndex = orderLineIndex+1;
    statusIndex = 0;
    json.I = orderLineIndex;
    json.J = statusIndex;
    json.UpdateString("orderShipment.orderLines.orderLine[i].lineNumber","2");
    json.UpdateString("orderShipment.orderLines.orderLine[i].sellerOrderId","92344");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status","Shipped");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement","EACH");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount","1");
    json.UpdateInt("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime",123);
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier","FedEx");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode","Express");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber","22344");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL","http://walmart/tracking/fedEx?&type=MP&seller_id=12345&promise_date=03/02/2020&dzip=92840&tracking_numbers=92344");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name","walmart");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1","walmart store 2");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city","Huntsville");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state","AL");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode","35805");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country","USA");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone","12344");
    json.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId","walmart@walmart.com");

    // resp: HttpResponse
    var resp = http.PostJson3("https://api-gateway.walmart.com/v3/orders/{purchaseOrderId}/shipping","application/json",json);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    console.log("Response status code: " + resp.StatusCode);

    resp.GetBodyJson(json);

    // A sample JSON response:

    // {
    //   "order": {
    //     "purchaseOrderId": "1234567891234",
    //     "customerOrderId": "9876543212345",
    //     "sellerOrderId": "13233454564657",
    //     "customerEmailId": "customer@walmartlabs.com",
    //     "orderDate": 1478284060000,
    //     "shippingInfo": {
    //       "phone": "6501234567",
    //       "estimatedDeliveryDate": 1479798000000,
    //       "estimatedShipDate": 1478674800000,
    //       "methodCode": "Value",
    //       "postalAddress": {
    //         "name": "Jane Doe",
    //         "address1": "123 Main street",
    //         "city": "Sunnyvale",
    //         "state": "CA",
    //         "postalCode": "94086",
    //         "country": "USA",
    //         "addressType": "OFFICE"
    //       }
    //     },
    //     "orderLines": {
    //       "orderLine": [
    //         {
    //           "lineNumber": "1",
    //           "item": {
    //             "productName": "Kenmore CF-1 or 20-86883 Canister Secondary Filter Generic 2 Pack",
    //             "sku": "wei-ASSET-675gku675"
    //           },
    //           "charges": {
    //             "charge": [
    //               {
    //                 "chargeType": "PRODUCT",
    //                 "chargeName": "ItemPrice",
    //                 "chargeAmount": {
    //                   "currency": "USD",
    //                   "amount": 555
    //                 },
    //                 "tax": {
    //                   "taxName": "Tax1",
    //                   "taxAmount": {
    //                     "currency": "USD",
    //                     "amount": 48.56
    //                   }
    //                 }
    //               }
    //             ]
    //           },
    //           "orderLineQuantity": {
    //             "unitOfMeasurement": "EACH",
    //             "amount": "1"
    //           },
    //           "statusDate": 1478297929000,
    //           "orderLineStatuses": {
    //             "orderLineStatus": [
    //               {
    //                 "status": "Shipped",
    //                 "statusQuantity": {
    //                   "unitOfMeasurement": "EACH",
    //                   "amount": "1"
    //                 },
    //                 "trackingInfo": {
    //                   "shipDateTime": 1438163400000,
    //                   "carrierName": {
    //                     "carrier": "FedEx"
    //                   },
    //                   "methodCode": "Value",
    //                   "trackingNumber": "911001572321619861",
    //                   "trackingURL": "http://www.fedex.com/Tracking?action=track=english=us=x=911001572321619861"
    //                 },
    //                 "returnCenterAddress": {
    //                   "name": "ABC",
    //                   "address1": "123 Bridge street",
    //                   "city": "Huntsville",
    //                   "state": "AL",
    //                   "postalCode": "35805",
    //                   "country": "USA",
    //                   "dayPhone": "6501234567",
    //                   "emailId": "RCemailaddress@company.com"
    //                 }
    //               }
    //             ]
    //           }
    //         }
    //       ]
    //     }
    //   }
    // }

    json.EmitCompact = false;
    console.log("Response JSON:");
    console.log(json.Emit());

    // Insert code here to load the above JSON into the json object.

    var lineNumber;
    var ProductName;
    var Sku;
    var UnitOfMeasurement;
    var Amount;
    var statusDate;
    var count_j;
    var chargeType;
    var chargeName;
    var v_Currency;
    var chargeAmountAmount;
    var TaxName;
    var TaxAmountCurrency;
    var TaxAmountAmount;
    var status;
    var statusQuantityUnitOfMeasurement;
    var statusQuantityAmount;
    var ShipDateTime;
    var Carrier;
    var trackingInfoMethodCode;
    var TrackingNumber;
    var TrackingURL;
    var returnCenterAddressName;
    var returnCenterAddressAddress1;
    var returnCenterAddressCity;
    var returnCenterAddressState;
    var returnCenterAddressPostalCode;
    var returnCenterAddressCountry;
    var DayPhone;
    var EmailId;

    var PurchaseOrderId = json.StringOf("order.purchaseOrderId");
    var CustomerOrderId = json.StringOf("order.customerOrderId");
    var SellerOrderId = json.StringOf("order.sellerOrderId");
    var CustomerEmailId = json.StringOf("order.customerEmailId");
    var OrderDate = json.IntOf("order.orderDate");
    var Phone = json.StringOf("order.shippingInfo.phone");
    var EstimatedDeliveryDate = json.IntOf("order.shippingInfo.estimatedDeliveryDate");
    var EstimatedShipDate = json.IntOf("order.shippingInfo.estimatedShipDate");
    var MethodCode = json.StringOf("order.shippingInfo.methodCode");
    var Name = json.StringOf("order.shippingInfo.postalAddress.name");
    var Address1 = json.StringOf("order.shippingInfo.postalAddress.address1");
    var City = json.StringOf("order.shippingInfo.postalAddress.city");
    var State = json.StringOf("order.shippingInfo.postalAddress.state");
    var PostalCode = json.StringOf("order.shippingInfo.postalAddress.postalCode");
    var Country = json.StringOf("order.shippingInfo.postalAddress.country");
    var AddressType = json.StringOf("order.shippingInfo.postalAddress.addressType");
    var i = 0;
    var j = 0;
    var count_i = json.SizeOfArray("order.orderLines.orderLine");
    while (i < count_i) {
        json.I = i;
        lineNumber = json.StringOf("order.orderLines.orderLine[i].lineNumber");
        ProductName = json.StringOf("order.orderLines.orderLine[i].item.productName");
        Sku = json.StringOf("order.orderLines.orderLine[i].item.sku");
        UnitOfMeasurement = json.StringOf("order.orderLines.orderLine[i].orderLineQuantity.unitOfMeasurement");
        Amount = json.StringOf("order.orderLines.orderLine[i].orderLineQuantity.amount");
        statusDate = json.IntOf("order.orderLines.orderLine[i].statusDate");
        j = 0;
        count_j = json.SizeOfArray("order.orderLines.orderLine[i].charges.charge");
        while (j < count_j) {
            json.J = j;
            chargeType = json.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeType");
            chargeName = json.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeName");
            v_Currency = json.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.currency");
            chargeAmountAmount = json.IntOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.amount");
            TaxName = json.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxName");
            TaxAmountCurrency = json.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.currency");
            TaxAmountAmount = json.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.amount");
            j = j+1;
        }

        j = 0;
        count_j = json.SizeOfArray("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus");
        while (j < count_j) {
            json.J = j;
            status = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status");
            statusQuantityUnitOfMeasurement = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement");
            statusQuantityAmount = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount");
            ShipDateTime = json.IntOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime");
            Carrier = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier");
            trackingInfoMethodCode = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode");
            TrackingNumber = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber");
            TrackingURL = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL");
            returnCenterAddressName = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name");
            returnCenterAddressAddress1 = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1");
            returnCenterAddressCity = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city");
            returnCenterAddressState = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state");
            returnCenterAddressPostalCode = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode");
            returnCenterAddressCountry = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country");
            DayPhone = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone");
            EmailId = json.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId");
            j = j+1;
        }

        i = i+1;
    }


}

chilkatExample();

 

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