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

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.

Chilkat React Native Downloads

React Native
import { Http, HttpResponse, JsonObject } from '@chilkat/react-native'

async function chilkatExample() {
  // This example assumes the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  const http = new Http();

  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"
  //                 }
  //               }
  //             ]
  //           }
  //         }
  //       ]
  //     }
  //   }
  // }

  const json = new JsonObject();
  let orderLineIndex = 0;
  let 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++;
  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');

  const resp = new HttpResponse();
  try {
    await http.httpJsonAsync('POST', 'https://api-gateway.walmart.com/v3/orders/{purchaseOrderId}/shipping', json, 'application/json', resp);
  } catch {
    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.

  let lineNumber = '';
  let productName = '';
  let sku = '';
  let unitOfMeasurement = '';
  let amount = '';
  let statusDate = 0;
  let countJ = 0;
  let chargeType = '';
  let chargeName = '';
  let vCurrency = '';
  let chargeAmountAmount = 0;
  let taxName = '';
  let taxAmountCurrency = '';
  let taxAmountAmount = '';
  let status = '';
  let statusQuantityUnitOfMeasurement = '';
  let statusQuantityAmount = '';
  let shipDateTime = 0;
  let carrier = '';
  let trackingInfoMethodCode = '';
  let trackingNumber = '';
  let trackingURL = '';
  let returnCenterAddressName = '';
  let returnCenterAddressAddress1 = '';
  let returnCenterAddressCity = '';
  let returnCenterAddressState = '';
  let returnCenterAddressPostalCode = '';
  let returnCenterAddressCountry = '';
  let dayPhone = '';
  let emailId = '';

  const purchaseOrderId = json.stringOf('order.purchaseOrderId');
  const customerOrderId = json.stringOf('order.customerOrderId');
  const sellerOrderId = json.stringOf('order.sellerOrderId');
  const customerEmailId = json.stringOf('order.customerEmailId');
  const orderDate = json.intOf('order.orderDate');
  const phone = json.stringOf('order.shippingInfo.phone');
  const estimatedDeliveryDate = json.intOf('order.shippingInfo.estimatedDeliveryDate');
  const estimatedShipDate = json.intOf('order.shippingInfo.estimatedShipDate');
  const methodCode = json.stringOf('order.shippingInfo.methodCode');
  const name = json.stringOf('order.shippingInfo.postalAddress.name');
  const address1 = json.stringOf('order.shippingInfo.postalAddress.address1');
  const city = json.stringOf('order.shippingInfo.postalAddress.city');
  const state = json.stringOf('order.shippingInfo.postalAddress.state');
  const postalCode = json.stringOf('order.shippingInfo.postalAddress.postalCode');
  const country = json.stringOf('order.shippingInfo.postalAddress.country');
  const addressType = json.stringOf('order.shippingInfo.postalAddress.addressType');
  let i = 0;
  let j = 0;
  const countI = json.sizeOfArray('order.orderLines.orderLine');
  while (i < countI) {
    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;
    countJ = json.sizeOfArray('order.orderLines.orderLine[i].charges.charge');
    while (j < countJ) {
      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');
      vCurrency = 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 = 0;
    countJ = json.sizeOfArray('order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus');
    while (j < countJ) {
      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++;
    }

    i++;
  }
}