Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) Walmart v3 Ship Order LinesSee more Walmart v3 ExamplesUpdates 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
LOCAL loHttp LOCAL lnSuccess LOCAL loJson LOCAL lnOrderLineIndex LOCAL lnStatusIndex LOCAL loResp LOCAL lcLineNumber LOCAL lcProductName LOCAL lcSku LOCAL lcUnitOfMeasurement LOCAL lcAmount LOCAL lnStatusDate LOCAL lnCount_j LOCAL lcChargeType LOCAL lcChargeName LOCAL lcV_Currency LOCAL lnChargeAmountAmount LOCAL lcTaxName LOCAL lcTaxAmountCurrency LOCAL lcTaxAmountAmount LOCAL lcStatus LOCAL lcStatusQuantityUnitOfMeasurement LOCAL lcStatusQuantityAmount LOCAL lnShipDateTime LOCAL lcCarrier LOCAL lcTrackingInfoMethodCode LOCAL lcTrackingNumber LOCAL lcTrackingURL LOCAL lcReturnCenterAddressName LOCAL lcReturnCenterAddressAddress1 LOCAL lcReturnCenterAddressCity LOCAL lcReturnCenterAddressState LOCAL lcReturnCenterAddressPostalCode LOCAL lcReturnCenterAddressCountry LOCAL lcDayPhone LOCAL lcEmailId LOCAL lcPurchaseOrderId LOCAL lcCustomerOrderId LOCAL lcSellerOrderId LOCAL lcCustomerEmailId LOCAL lnOrderDate LOCAL lcPhone LOCAL lnEstimatedDeliveryDate LOCAL lnEstimatedShipDate LOCAL lcMethodCode LOCAL lcName LOCAL lcAddress1 LOCAL lcCity LOCAL lcState LOCAL lcPostalCode LOCAL lcCountry LOCAL lcAddressType LOCAL i LOCAL j LOCAL lnCount_i * This example assumes the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http') loHttp = CreateObject('Chilkat.Http') loHttp.SetRequestHeader("WM_QOS.CORRELATION_ID","b3261d2d-028a-4ef7-8602-633c23200af6") loHttp.SetRequestHeader("WM_SEC.ACCESS_TOKEN","eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....") loHttp.SetRequestHeader("Accept","application/json") loHttp.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" * } * } * ] * } * } * ] * } * } * } * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJson = CreateObject('Chilkat.JsonObject') lnOrderLineIndex = 0 lnStatusIndex = 0 loJson.I = lnOrderLineIndex loJson.J = lnStatusIndex loJson.UpdateString("orderShipment.orderLines.orderLine[i].lineNumber","1") loJson.UpdateBool("orderShipment.orderLines.orderLine[i].intentToCancelOverride",0) loJson.UpdateString("orderShipment.orderLines.orderLine[i].sellerOrderId","92344") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status","Shipped") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement","EACH") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount","1") loJson.UpdateInt("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime",123) loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier","UPS") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode","Standard") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber","22344") loJson.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") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name","walmart") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1","walmart store 2") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city","Huntsville") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state","AL") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode","35805") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country","USA") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone","12344") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId","walmart@walmart.com") lnOrderLineIndex = lnOrderLineIndex + 1 lnStatusIndex = 0 loJson.I = lnOrderLineIndex loJson.J = lnStatusIndex loJson.UpdateString("orderShipment.orderLines.orderLine[i].lineNumber","2") loJson.UpdateString("orderShipment.orderLines.orderLine[i].sellerOrderId","92344") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status","Shipped") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement","EACH") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount","1") loJson.UpdateInt("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime",123) loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier","FedEx") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode","Express") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber","22344") loJson.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") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name","walmart") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1","walmart store 2") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city","Huntsville") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state","AL") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode","35805") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country","USA") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone","12344") loJson.UpdateString("orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId","walmart@walmart.com") loResp = loHttp.PostJson3("https://api-gateway.walmart.com/v3/orders/{purchaseOrderId}/shipping","application/json",loJson) IF (loHttp.LastMethodSuccess = 0) THEN ? loHttp.LastErrorText RELEASE loHttp RELEASE loJson CANCEL ENDIF ? "Response status code: " + STR(loResp.StatusCode) loResp.GetBodyJson(loJson) RELEASE loResp * 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" * } * } * ] * } * } * ] * } * } * } loJson.EmitCompact = 0 ? "Response JSON:" ? loJson.Emit() * Insert code here to load the above JSON into the json object. lcPurchaseOrderId = loJson.StringOf("order.purchaseOrderId") lcCustomerOrderId = loJson.StringOf("order.customerOrderId") lcSellerOrderId = loJson.StringOf("order.sellerOrderId") lcCustomerEmailId = loJson.StringOf("order.customerEmailId") lnOrderDate = loJson.IntOf("order.orderDate") lcPhone = loJson.StringOf("order.shippingInfo.phone") lnEstimatedDeliveryDate = loJson.IntOf("order.shippingInfo.estimatedDeliveryDate") lnEstimatedShipDate = loJson.IntOf("order.shippingInfo.estimatedShipDate") lcMethodCode = loJson.StringOf("order.shippingInfo.methodCode") lcName = loJson.StringOf("order.shippingInfo.postalAddress.name") lcAddress1 = loJson.StringOf("order.shippingInfo.postalAddress.address1") lcCity = loJson.StringOf("order.shippingInfo.postalAddress.city") lcState = loJson.StringOf("order.shippingInfo.postalAddress.state") lcPostalCode = loJson.StringOf("order.shippingInfo.postalAddress.postalCode") lcCountry = loJson.StringOf("order.shippingInfo.postalAddress.country") lcAddressType = loJson.StringOf("order.shippingInfo.postalAddress.addressType") i = 0 j = 0 lnCount_i = loJson.SizeOfArray("order.orderLines.orderLine") DO WHILE i < lnCount_i loJson.I = i lcLineNumber = loJson.StringOf("order.orderLines.orderLine[i].lineNumber") lcProductName = loJson.StringOf("order.orderLines.orderLine[i].item.productName") lcSku = loJson.StringOf("order.orderLines.orderLine[i].item.sku") lcUnitOfMeasurement = loJson.StringOf("order.orderLines.orderLine[i].orderLineQuantity.unitOfMeasurement") lcAmount = loJson.StringOf("order.orderLines.orderLine[i].orderLineQuantity.amount") lnStatusDate = loJson.IntOf("order.orderLines.orderLine[i].statusDate") 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") lcV_Currency = loJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.currency") lnChargeAmountAmount = loJson.IntOf("order.orderLines.orderLine[i].charges.charge[j].chargeAmount.amount") lcTaxName = loJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxName") lcTaxAmountCurrency = loJson.StringOf("order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.currency") lcTaxAmountAmount = loJson.StringOf("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") lnShipDateTime = loJson.IntOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime") lcCarrier = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier") lcTrackingInfoMethodCode = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode") lcTrackingNumber = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber") lcTrackingURL = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL") lcReturnCenterAddressName = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name") lcReturnCenterAddressAddress1 = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1") lcReturnCenterAddressCity = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city") lcReturnCenterAddressState = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state") lcReturnCenterAddressPostalCode = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode") lcReturnCenterAddressCountry = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country") lcDayPhone = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone") lcEmailId = loJson.StringOf("order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId") j = j + 1 ENDDO i = i + 1 ENDDO RELEASE loHttp RELEASE loJson |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.