Skip to main content
Published: July 13 2011, 5:40:00 AMUpdated: November 28 2020, 9:56:27 PM

It is always a good idea to keep the buyer posted about the order shipping status. Use the CompleteSale call mark an item as shipped. You can also upload a shipment tracking number so that the buyer can track the order.

This is a C# sample that demonstrates how to mark an item as shipped and upload the tracking number. The sample has been written using .NET SDK.

Below is the code. Corresponding SOAP request is attached with this article.

Note: If an item has to be shipped in multiple shipments/packages use multiple <ShipmentTrackingDetails> container to specifty the tracking details.

using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Util;
using eBay.Service.Core.Soap;

namespace Trading_Samples
{
    public class OrderManagement
    {   
        private void CompleteSale()     
      {
                         
            //create the context
            ApiContext context = new ApiContext();

            //set the User token
            context.ApiCredential.eBayToken = "Your token";

            //set the server url
            context.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi";

            //enable logging
            context.ApiLogManager = new ApiLogManager();
            context.ApiLogManager.ApiLoggerList.Add(new FileLogger("log.txt", true, true, true));
            context.ApiLogManager.EnableLogging = true;

            //set the version
            context.Version = "727";
            context.Site = SiteCodeType.Australia;    

            //Create the call and set the fields
            CompleteSaleCall apicall = new CompleteSaleCall(context);

            //Either ItemID-TransactionID or OrderLineItemID or OrderID is required. If item is part of an order, specify OrderID.
            apicall.OrderLineItemID = "110050084943-25331459001";
            apicall.Shipped = true;
            apicall.Shipment = new ShipmentType();
            apicall.Shipment.ShipmentTrackingDetails = new ShipmentTrackingDetailsTypeCollection();

            ShipmentTrackingDetailsType shpmnt = new ShipmentTrackingDetailsType();
            shpmnt.ShipmentTrackingNumber = "VZ9478668"; 
            shpmnt.ShippingCarrierUsed = "YourCarrier";
            
            apicall.Shipment.ShipmentTrackingDetails.Add(shpmnt);

            //Specify time in GMT. This is an optional field
            //If you don't specify a value for the ShippedTime, it will be defaulted to the time at which the call was made
            apicall.Shipment.ShippedTime = new DateTime(2011, 3, 5, 10, 0, 0).ToUniversalTime();

            //call the Execute method
            apicall.Execute();
            Console.WriteLine(apicall.ApiResponse.Ack);
              
       }

  }

}

How well did this answer your question?
Answers others found helpful