Sample code for 30+ languages & platforms
SQL Server

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 SQL Server Downloads

SQL Server
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @success int
    SELECT @success = 0

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

    DECLARE @http int
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'WM_QOS.CORRELATION_ID', 'b3261d2d-028a-4ef7-8602-633c23200af6'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'WM_SEC.ACCESS_TOKEN', 'eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM.....'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept', 'application/json'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, '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"
    --                 }
    --               }
    --             ]
    --           }
    --         }
    --       ]
    --     }
    --   }
    -- }

    DECLARE @json int
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT

    DECLARE @orderLineIndex int
    SELECT @orderLineIndex = 0
    DECLARE @statusIndex int
    SELECT @statusIndex = 0
    EXEC sp_OASetProperty @json, 'I', @orderLineIndex
    EXEC sp_OASetProperty @json, 'J', @statusIndex
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].lineNumber', '1'
    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'orderShipment.orderLines.orderLine[i].intentToCancelOverride', 0
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].sellerOrderId', '92344'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status', 'Shipped'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement', 'EACH'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount', '1'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier', 'UPS'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode', 'Standard'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber', '22344'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, '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'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name', 'walmart'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1', 'walmart store 2'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city', 'Huntsville'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state', 'AL'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode', '35805'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country', 'USA'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone', '12344'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId', 'walmart@walmart.com'

    SELECT @orderLineIndex = @orderLineIndex + 1
    SELECT @statusIndex = 0
    EXEC sp_OASetProperty @json, 'I', @orderLineIndex
    EXEC sp_OASetProperty @json, 'J', @statusIndex
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].lineNumber', '2'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].sellerOrderId', '92344'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status', 'Shipped'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement', 'EACH'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount', '1'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime', 123
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier', 'FedEx'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode', 'Express'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber', '22344'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, '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'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name', 'walmart'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1', 'walmart store 2'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city', 'Huntsville'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state', 'AL'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode', '35805'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country', 'USA'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone', '12344'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'orderShipment.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId', 'walmart@walmart.com'

    DECLARE @resp int
    EXEC @hr = sp_OACreate 'Chilkat.HttpResponse', @resp OUT

    EXEC sp_OAMethod @http, 'HttpJson', @success OUT, 'POST', 'https://api-gateway.walmart.com/v3/orders/{purchaseOrderId}/shipping', @json, 'application/json', @resp
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @json
        EXEC @hr = sp_OADestroy @resp
        RETURN
      END


    EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
    PRINT 'Response status code: ' + @iTmp0

    EXEC sp_OAMethod @resp, 'GetBodyJson', @success OUT, @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"
    --                 }
    --               }
    --             ]
    --           }
    --         }
    --       ]
    --     }
    --   }
    -- }

    EXEC sp_OASetProperty @json, 'EmitCompact', 0

    PRINT 'Response JSON:'
    EXEC sp_OAMethod @json, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

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

    DECLARE @lineNumber nvarchar(4000)

    DECLARE @ProductName nvarchar(4000)

    DECLARE @Sku nvarchar(4000)

    DECLARE @UnitOfMeasurement nvarchar(4000)

    DECLARE @Amount nvarchar(4000)

    DECLARE @statusDate int

    DECLARE @count_j int

    DECLARE @chargeType nvarchar(4000)

    DECLARE @chargeName nvarchar(4000)

    DECLARE @v_Currency nvarchar(4000)

    DECLARE @chargeAmountAmount int

    DECLARE @TaxName nvarchar(4000)

    DECLARE @TaxAmountCurrency nvarchar(4000)

    DECLARE @TaxAmountAmount nvarchar(4000)

    DECLARE @status nvarchar(4000)

    DECLARE @statusQuantityUnitOfMeasurement nvarchar(4000)

    DECLARE @statusQuantityAmount nvarchar(4000)

    DECLARE @ShipDateTime int

    DECLARE @Carrier nvarchar(4000)

    DECLARE @trackingInfoMethodCode nvarchar(4000)

    DECLARE @TrackingNumber nvarchar(4000)

    DECLARE @TrackingURL nvarchar(4000)

    DECLARE @returnCenterAddressName nvarchar(4000)

    DECLARE @returnCenterAddressAddress1 nvarchar(4000)

    DECLARE @returnCenterAddressCity nvarchar(4000)

    DECLARE @returnCenterAddressState nvarchar(4000)

    DECLARE @returnCenterAddressPostalCode nvarchar(4000)

    DECLARE @returnCenterAddressCountry nvarchar(4000)

    DECLARE @DayPhone nvarchar(4000)

    DECLARE @EmailId nvarchar(4000)

    DECLARE @PurchaseOrderId nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @PurchaseOrderId OUT, 'order.purchaseOrderId'
    DECLARE @CustomerOrderId nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @CustomerOrderId OUT, 'order.customerOrderId'
    DECLARE @SellerOrderId nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @SellerOrderId OUT, 'order.sellerOrderId'
    DECLARE @CustomerEmailId nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @CustomerEmailId OUT, 'order.customerEmailId'
    DECLARE @OrderDate int
    EXEC sp_OAMethod @json, 'IntOf', @OrderDate OUT, 'order.orderDate'
    DECLARE @Phone nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @Phone OUT, 'order.shippingInfo.phone'
    DECLARE @EstimatedDeliveryDate int
    EXEC sp_OAMethod @json, 'IntOf', @EstimatedDeliveryDate OUT, 'order.shippingInfo.estimatedDeliveryDate'
    DECLARE @EstimatedShipDate int
    EXEC sp_OAMethod @json, 'IntOf', @EstimatedShipDate OUT, 'order.shippingInfo.estimatedShipDate'
    DECLARE @MethodCode nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @MethodCode OUT, 'order.shippingInfo.methodCode'
    DECLARE @Name nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @Name OUT, 'order.shippingInfo.postalAddress.name'
    DECLARE @Address1 nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @Address1 OUT, 'order.shippingInfo.postalAddress.address1'
    DECLARE @City nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @City OUT, 'order.shippingInfo.postalAddress.city'
    DECLARE @State nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @State OUT, 'order.shippingInfo.postalAddress.state'
    DECLARE @PostalCode nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @PostalCode OUT, 'order.shippingInfo.postalAddress.postalCode'
    DECLARE @Country nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @Country OUT, 'order.shippingInfo.postalAddress.country'
    DECLARE @AddressType nvarchar(4000)
    EXEC sp_OAMethod @json, 'StringOf', @AddressType OUT, 'order.shippingInfo.postalAddress.addressType'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @j int
    SELECT @j = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'order.orderLines.orderLine'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @json, 'I', @i
        EXEC sp_OAMethod @json, 'StringOf', @lineNumber OUT, 'order.orderLines.orderLine[i].lineNumber'
        EXEC sp_OAMethod @json, 'StringOf', @ProductName OUT, 'order.orderLines.orderLine[i].item.productName'
        EXEC sp_OAMethod @json, 'StringOf', @Sku OUT, 'order.orderLines.orderLine[i].item.sku'
        EXEC sp_OAMethod @json, 'StringOf', @UnitOfMeasurement OUT, 'order.orderLines.orderLine[i].orderLineQuantity.unitOfMeasurement'
        EXEC sp_OAMethod @json, 'StringOf', @Amount OUT, 'order.orderLines.orderLine[i].orderLineQuantity.amount'
        EXEC sp_OAMethod @json, 'IntOf', @statusDate OUT, 'order.orderLines.orderLine[i].statusDate'
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'order.orderLines.orderLine[i].charges.charge'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'StringOf', @chargeType OUT, 'order.orderLines.orderLine[i].charges.charge[j].chargeType'
            EXEC sp_OAMethod @json, 'StringOf', @chargeName OUT, 'order.orderLines.orderLine[i].charges.charge[j].chargeName'
            EXEC sp_OAMethod @json, 'StringOf', @v_Currency OUT, 'order.orderLines.orderLine[i].charges.charge[j].chargeAmount.currency'
            EXEC sp_OAMethod @json, 'IntOf', @chargeAmountAmount OUT, 'order.orderLines.orderLine[i].charges.charge[j].chargeAmount.amount'
            EXEC sp_OAMethod @json, 'StringOf', @TaxName OUT, 'order.orderLines.orderLine[i].charges.charge[j].tax.taxName'
            EXEC sp_OAMethod @json, 'StringOf', @TaxAmountCurrency OUT, 'order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.currency'
            EXEC sp_OAMethod @json, 'StringOf', @TaxAmountAmount OUT, 'order.orderLines.orderLine[i].charges.charge[j].tax.taxAmount.amount'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'StringOf', @status OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].status'
            EXEC sp_OAMethod @json, 'StringOf', @statusQuantityUnitOfMeasurement OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.unitOfMeasurement'
            EXEC sp_OAMethod @json, 'StringOf', @statusQuantityAmount OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].statusQuantity.amount'
            EXEC sp_OAMethod @json, 'IntOf', @ShipDateTime OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.shipDateTime'
            EXEC sp_OAMethod @json, 'StringOf', @Carrier OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.carrierName.carrier'
            EXEC sp_OAMethod @json, 'StringOf', @trackingInfoMethodCode OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.methodCode'
            EXEC sp_OAMethod @json, 'StringOf', @TrackingNumber OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingNumber'
            EXEC sp_OAMethod @json, 'StringOf', @TrackingURL OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].trackingInfo.trackingURL'
            EXEC sp_OAMethod @json, 'StringOf', @returnCenterAddressName OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.name'
            EXEC sp_OAMethod @json, 'StringOf', @returnCenterAddressAddress1 OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.address1'
            EXEC sp_OAMethod @json, 'StringOf', @returnCenterAddressCity OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.city'
            EXEC sp_OAMethod @json, 'StringOf', @returnCenterAddressState OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.state'
            EXEC sp_OAMethod @json, 'StringOf', @returnCenterAddressPostalCode OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.postalCode'
            EXEC sp_OAMethod @json, 'StringOf', @returnCenterAddressCountry OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.country'
            EXEC sp_OAMethod @json, 'StringOf', @DayPhone OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.dayPhone'
            EXEC sp_OAMethod @json, 'StringOf', @EmailId OUT, 'order.orderLines.orderLine[i].orderLineStatuses.orderLineStatus[j].returnCenterAddress.emailId'
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @json
    EXEC @hr = sp_OADestroy @resp


END
GO