Click or drag to resize

Create Courier Order

[This is preliminary documentation and is subject to change.]

This walkthrough is for creating a courier (Purolator, Canada Post, PuroPost) order with one AddOrder(OrderRequestV3) request; if you are creating an LTL order then see the LTL walkthrough. This walkthrough assumes that Purolator is handling customs; if you are using a different customs broker then ignore code related to Item data.

  1. Create and populate an OrderRequestV3 object.

    CredentialInfo credentials = new CredentialInfo { UserName = "User", Password = "****", ClientID = "0000000" };
    
    OrderRequestV3 orderRequest = new OrderRequestV3
    {
        Credentials = credentials,
        ShipToAddress = new Address
        {
            Name       = "Test Customer Name",
            Add1       = "560 Kings Road",
            City       = "Sydney",
            StateProv  = "NS",
            PostalCode = "B1S1B8",
            Country    = "CA"
        },
        OrderNumber    = "Order-13544364-1",
        ShipMethod     = "GROUND",
        LabelType      = "ZPLIMAGES",
        ShipDate       = DateTime.Today,
        Packages = new List<RequestPackageV3>
        {
            new RequestPackageV3 { PackageID = "PKG-13544364-01", WeightUOM = "LB", Weight = 10.0m, }
        }.ToArray(),
        Items = new List<RequestItemV3>
        {
            new RequestItemV3
            {
                SKU         = "x35135",
                CustomsDesc = "Documents",
                Quantity    = 2,
                TotalValue  = 10,
                Currency    = "CAD",
                CountryOfOrigin = "United States",
            }
        }.ToArray()
    };
  2. Submit request.

    ShippingServicesSoapClient client = new ShippingServicesSoapClient("PurolatorWebService");
    OrderResponse orderResponse = client.AddOrder(orderRequest);
    
    if (orderResponse.Status == (int)SeverityEnum.Error)
    {
        foreach (ResponseMessage message in orderResponse.Messages)
        {
            Console.Write(message.Message);
        }
    }
    return orderResponse;
  3. Print and apply the label for each package. See ZPL page for more information.

    foreach (ResponsePackage package in orderResponse.Packages)
    {
        // This method sends raw ZPL data to the printer using Windows API.
        RawDataPrinterHelper.SendStringToPrinter(zplPrinterName, package.ZPLCode);
    }
  4. When all orders have the correct labels attached and are ready to ship, create a Closeout to complete processing. See the Closeout page for more information.