Click or drag to resize

Create Single Shipment LTL Order

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

This walkthrough is for creating a single consolidated LTL shipment with AddLTLOrder(LTLOrderRequest); if you are creating a courier (Purolator, Canada Post, UPS) order then see the courier walkthrough. This walkthrough assumes that Purolator is handling customs; if you are using a different customs broker then ignore code related to Item data.

The difference between AddLTLOrder and AddOrder(OrderRequestV3) is that shipments created with AddOrder have not been consolidated.

  1. Create and populate a LTLOrderRequest object.

    In LTL, Packages represent containers instead of representing parcels. Adding Pallet information is typical, but not required.

    LTLOrderRequest ltlOrderRequest = new LTLOrderRequest
    {
        Credentials     = credentials,
        ShipToAddress   = new Address
        {
            Name        = "Test Customer Name",
            Add1        = "560 Kings Road",
            City        = "Sydney",
            StateProv   = "NS",
            PostalCode  = "B1S1B8",
            Country     = "CA"
        },
        OrderNumber     = "LTLOrder-LSA5281",
        LabelType       = "ZPLIMAGES",
        ShipDate        = DateTime.Today,
        GrossWeight     = 25 + 1 * palletWeight,
        Pallets         = new[] { new LTLPalletRequest { PalletNumber = "LSA5281" } }, // optional
        Items           = new[]
        {
            new RequestItemV3
            {
                SKU         = "L61832",
                CustomsDesc = "Ladder",
                Quantity    = 1,
                TotalValue  = (decimal)89.98,
                Currency    = "CAD",
                CountryOfOrigin = "United States",
            }
        },
    };
  2. Submit request. If the response indicates any errors, then fix and resubmit the request.

    LTLOrderResponse ltlOrderResponse = client.AddLTLOrder(ltlOrderRequest);
    
    if (ltlOrderResponse.Status == (int)SeverityEnum.Error)
    {
        foreach (ResponseMessage message in ltlOrderResponse.Messages)
        {
            switch (message.Number)
            {
                case 1:  // Invalid Credentials
                    Console.WriteLine("Invalid Credentials");
                    return ltlOrderResponse;
                case 3:  // Ship Method not valid - the postal code may be invalid
                    Console.WriteLine("Invalid ship method for specified postal code.");
                    return ltlOrderResponse;
                case 35: // LTL shipments must be standard delivery time.
                    Console.WriteLine("LTL shipments must be standard delivery time.");
                    ltlOrderRequest.SpecialServices = null;
                    break;
            }
            // Add cases to fix other errors....
        }
    
        ltlOrderResponse = client.AddLTLOrder(ltlOrderRequest);
        if (ltlOrderResponse.Status == (int)SeverityEnum.Error)
            return ltlOrderResponse;
    }
  3. Print and apply the label for each pallet and container. See ZPL page for more information.

    // Print pallet and container labels for valid orders.
    var containerLabels = ltlOrderResponse.Packages.Select(p => p.ZPLCode);
    var palletLabels = ltlOrderResponse.Pallets.Select(p => p.ZPLCode);
    foreach (string zplCode in containerLabels.Union(palletLabels))
        RawDataPrinterHelper.SendStringToPrinter(zplPrinterName, zplCode);
  4. When all pallets and containers have the correct labels attached and are ready to ship, create a Closeout to complete processing. See the Closeout page for more information.