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
(DataFlex) 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
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Boolean iSuccess Variant vJson Handle hoJson Integer iOrderLineIndex Integer iStatusIndex Variant vResp Handle hoResp String sLineNumber String sProductName String sSku String sUnitOfMeasurement String sAmount Integer iStatusDate Integer iCount_j String sChargeType String sChargeName String sV_Currency Integer iChargeAmountAmount String sTaxName String sTaxAmountCurrency String sTaxAmountAmount String sStatus String sStatusQuantityUnitOfMeasurement String sStatusQuantityAmount Integer iShipDateTime String sCarrier String sTrackingInfoMethodCode String sTrackingNumber String sTrackingURL String sReturnCenterAddressName String sReturnCenterAddressAddress1 String sReturnCenterAddressCity String sReturnCenterAddressState String sReturnCenterAddressPostalCode String sReturnCenterAddressCountry String sDayPhone String sEmailId String sPurchaseOrderId String sCustomerOrderId String sSellerOrderId String sCustomerEmailId Integer iOrderDate String sPhone Integer iEstimatedDeliveryDate Integer iEstimatedShipDate String sMethodCode String sName String sAddress1 String sCity String sState String sPostalCode String sCountry String sAddressType Integer i Integer j Integer iCount_i String sTemp1 Integer iTemp1 Boolean bTemp1 // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Send ComSetRequestHeader To hoHttp "WM_QOS.CORRELATION_ID" "b3261d2d-028a-4ef7-8602-633c23200af6" Send ComSetRequestHeader To hoHttp "WM_SEC.ACCESS_TOKEN" "eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM....." Send ComSetRequestHeader To hoHttp "Accept" "application/json" Send ComSetRequestHeader To hoHttp "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" // } // } // ] // } // } // ] // } // } // } Get Create (RefClass(cComChilkatJsonObject)) To hoJson If (Not(IsComObjectCreated(hoJson))) Begin Send CreateComObject of hoJson End Move 0 To iOrderLineIndex Move 0 To iStatusIndex Set ComI Of hoJson To iOrderLineIndex Set ComJ Of hoJson To iStatusIndex Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].lineNumber" "1" To iSuccess Get ComUpdateBool Of hoJson "orderShipment.orderLines.orderLine[i].intentToCancelOverride" False To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].sellerOrderId" "92344" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status" "Shipped" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement" "EACH" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount" "1" To iSuccess Get ComUpdateInt Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime" 123 To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier" "UPS" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode" "Standard" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber" "22344" To iSuccess Get ComUpdateString Of hoJson "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" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name" "walmart" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1" "walmart store 2" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city" "Huntsville" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state" "AL" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode" "35805" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country" "USA" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone" "12344" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId" "walmart@walmart.com" To iSuccess Move (iOrderLineIndex + 1) To iOrderLineIndex Move 0 To iStatusIndex Set ComI Of hoJson To iOrderLineIndex Set ComJ Of hoJson To iStatusIndex Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].lineNumber" "2" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].sellerOrderId" "92344" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status" "Shipped" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement" "EACH" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount" "1" To iSuccess Get ComUpdateInt Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime" 123 To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier" "FedEx" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode" "Express" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber" "22344" To iSuccess Get ComUpdateString Of hoJson "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" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name" "walmart" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1" "walmart store 2" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city" "Huntsville" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state" "AL" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode" "35805" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country" "USA" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone" "12344" To iSuccess Get ComUpdateString Of hoJson "orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId" "walmart@walmart.com" To iSuccess Get pvComObject of hoJson to vJson Get ComPostJson3 Of hoHttp "https://api-gateway.walmart.com/v3/orders/{purchaseOrderId}/shipping" "application/json" vJson To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComStatusCode Of hoResp To iTemp1 Showln "Response status code: " iTemp1 Get pvComObject of hoJson to vJson Get ComGetBodyJson Of hoResp vJson To iSuccess Send Destroy of hoResp // 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" // } // } // ] // } // } // ] // } // } // } Set ComEmitCompact Of hoJson To False Showln "Response JSON:" Get ComEmit Of hoJson To sTemp1 Showln sTemp1 // Insert code here to load the above JSON into the json object. Get ComStringOf Of hoJson "order.purchaseOrderId" To sPurchaseOrderId Get ComStringOf Of hoJson "order.customerOrderId" To sCustomerOrderId Get ComStringOf Of hoJson "order.sellerOrderId" To sSellerOrderId Get ComStringOf Of hoJson "order.customerEmailId" To sCustomerEmailId Get ComIntOf Of hoJson "order.orderDate" To iOrderDate Get ComStringOf Of hoJson "order.shippingInfo.phone" To sPhone Get ComIntOf Of hoJson "order.shippingInfo.estimatedDeliveryDate" To iEstimatedDeliveryDate Get ComIntOf Of hoJson "order.shippingInfo.estimatedShipDate" To iEstimatedShipDate Get ComStringOf Of hoJson "order.shippingInfo.methodCode" To sMethodCode Get ComStringOf Of hoJson "order.shippingInfo.postalAddress.name" To sName Get ComStringOf Of hoJson "order.shippingInfo.postalAddress.address1" To sAddress1 Get ComStringOf Of hoJson "order.shippingInfo.postalAddress.city" To sCity Get ComStringOf Of hoJson "order.shippingInfo.postalAddress.state" To sState Get ComStringOf Of hoJson "order.shippingInfo.postalAddress.postalCode" To sPostalCode Get ComStringOf Of hoJson "order.shippingInfo.postalAddress.country" To sCountry Get ComStringOf Of hoJson "order.shippingInfo.postalAddress.addressType" To sAddressType Move 0 To i Move 0 To j Get ComSizeOfArray Of hoJson "order.orderLines.orderLine" To iCount_i While (i < iCount_i) Set ComI Of hoJson To i Get ComStringOf Of hoJson "order.orderLines.orderLine[i].lineNumber" To sLineNumber Get ComStringOf Of hoJson "order.orderLines.orderLine[i].item.productName" To sProductName Get ComStringOf Of hoJson "order.orderLines.orderLine[i].item.sku" To sSku Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineQuantity.unitOfMeasurement" To sUnitOfMeasurement Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineQuantity.amount" To sAmount Get ComIntOf Of hoJson "order.orderLines.orderLine[i].statusDate" To iStatusDate Move 0 To j Get ComSizeOfArray Of hoJson "order.orderLines.orderLine[i].charges.charge" To iCount_j While (j < iCount_j) Set ComJ Of hoJson To j Get ComStringOf Of hoJson "order.orderLines.orderLine[i].charges.charge[j].chargeType" To sChargeType Get ComStringOf Of hoJson "order.orderLines.orderLine[i].charges.charge[j].chargeName" To sChargeName Get ComStringOf Of hoJson "order.orderLines.orderLine[i].charges.charge[j].chargeAmount.currency" To sV_Currency Get ComIntOf Of hoJson "order.orderLines.orderLine[i].charges.charge[j].chargeAmount.amount" To iChargeAmountAmount Get ComStringOf Of hoJson "order.orderLines.orderLine[i].charges.charge[j].tax.taxName" To sTaxName Get ComStringOf Of hoJson "order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.currency" To sTaxAmountCurrency Get ComStringOf Of hoJson "order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.amount" To sTaxAmountAmount Move (j + 1) To j Loop Move 0 To j Get ComSizeOfArray Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus" To iCount_j While (j < iCount_j) Set ComJ Of hoJson To j Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status" To sStatus Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement" To sStatusQuantityUnitOfMeasurement Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount" To sStatusQuantityAmount Get ComIntOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime" To iShipDateTime Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier" To sCarrier Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode" To sTrackingInfoMethodCode Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber" To sTrackingNumber Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL" To sTrackingURL Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name" To sReturnCenterAddressName Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1" To sReturnCenterAddressAddress1 Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city" To sReturnCenterAddressCity Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state" To sReturnCenterAddressState Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode" To sReturnCenterAddressPostalCode Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country" To sReturnCenterAddressCountry Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone" To sDayPhone Get ComStringOf Of hoJson "order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId" To sEmailId Move (j + 1) To j Loop Move (i + 1) To i Loop End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.