ShippingRates 4.0.6

dotnet add package ShippingRates --version 4.0.6
                    
NuGet\Install-Package ShippingRates -Version 4.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ShippingRates" Version="4.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ShippingRates" Version="4.0.6" />
                    
Directory.Packages.props
<PackageReference Include="ShippingRates" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ShippingRates --version 4.0.6
                    
#r "nuget: ShippingRates, 4.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ShippingRates@4.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ShippingRates&version=4.0.6
                    
Install as a Cake Addin
#tool nuget:?package=ShippingRates&version=4.0.6
                    
Install as a Cake Tool

ShippingRates

Build NuGet Version

ShippingRates is a .NET library for retrieving shipping rates from UPS, FedEx, USPS, and DHL APIs.

Why Use It

  • Query multiple carriers through one RateManager
  • Work with sync or async APIs
  • Support multiple packages in a single shipment
  • Apply shipment-level options such as Saturday delivery
  • Extend returned prices with custom rate adjusters

Supported Platforms

  • .NET 6+
  • .NET Standard 2.0
  • .NET Framework 4.6.1+

Install

Available on NuGet:

dotnet add package ShippingRates

Choose Your Path

Upgrade Notes

ShippingRates 4.x includes FedEx breaking changes and uses the modern FedEx REST API with OAuth 2.0.

If you are upgrading an existing integration, start with Breaking changes.

Quick Start

using System.Collections.Generic;
using System.Net.Http;
using ShippingRates;
using ShippingRates.ShippingProviders.FedEx;
using ShippingRates.ShippingProviders;
using ShippingRates.ShippingProviders.Usps;

using var httpClient = new HttpClient();

var rateManager = new RateManager();

var upsConfiguration = new UPSProviderConfiguration
{
    ClientId = upsClientId,
    ClientSecret = upsClientSecret,
    AccountNumber = upsAccountNumber,
    UseProduction = false
};
rateManager.AddProvider(new UPSProvider(upsConfiguration, httpClient));

var fedExConfiguration = new FedExProviderConfiguration
{
    ClientId = fedexClientId,
    ClientSecret = fedexClientSecret,
    AccountNumber = fedexAccountNumber,
    HubId = fedexHubId,
    UseProduction = false
};
rateManager.AddProvider(new FedExProvider(fedExConfiguration, httpClient));

var uspsConfiguration = new UspsProviderConfiguration
{
    ClientId = uspsClientId,
    ClientSecret = uspsClientSecret,
    UseProduction = false
};
rateManager.AddProvider(new UspsProvider(uspsConfiguration, httpClient));

var dhlConfiguration = new DHLProviderConfiguration(dhlSiteId, dhlPassword, useProduction: false);
rateManager.AddProvider(new DHLProvider(dhlConfiguration, httpClient));

var packages = new List<Package>
{
    new Package(12, 12, 12, 35, 150),
    new PackageKgCm(4, 4, 6, 15, 250)
};

var origin = new Address("", "CT", "06405", "US");
var destination = new Address("", "", "20852", "US");

Shipment shipment = await rateManager.GetRatesAsync(origin, destination, packages);

foreach (Rate rate in shipment.Rates)
{
    Console.WriteLine(rate);
}

The sample app in SampleApp/Program.cs shows a fuller end-to-end setup.

Carrier Setup

Use the carrier-specific setup pages for constructor overloads, configuration options, and examples:

Shipment Options

Pass shipment-level options through ShipmentOptions:

var shipment = await rateManager.GetRatesAsync(
    origin,
    destination,
    packages,
    new ShipmentOptions
    {
        SaturdayDelivery = true,
        ShippingDate = new DateTime(2020, 7, 15),
        PreferredCurrencyCode = "EUR",
        FedExOneRate = true,
        FedExPackagingTypeOverride = FedExPackagingType.FedExEnvelope
    });
Name Default Meaning
SaturdayDelivery false Request Saturday delivery rates when available.
ShippingDate null Pickup date. Uses the current date and time when omitted.
PreferredCurrencyCode USD Preferred ISO currency code for FedEx rates.
FedExOneRate false Enable FedEx One Rate pricing.
FedExPackagingTypeOverride null Override the FedEx packaging type for the shipment.
FedExOneRatePackageOverride null Legacy FedEx One Rate override. Prefer FedExPackagingTypeOverride.

If ShipmentOptions.SaturdayDelivery is enabled, inspect Rate.Options.SaturdayDelivery on returned rates:

var anySaturdayDeliveryMethods = shipment.Rates.Any(r => r.Options.SaturdayDelivery);

Error Handling

RateManager.GetRates and RateManager.GetRatesAsync aggregate provider responses into:

  • shipment.Errors for carrier/API errors that are generally safe to surface to end users
  • shipment.InternalErrors for internal processing failures and diagnostics
foreach (var error in shipment.Errors)
{
    Console.WriteLine(error.Number);
    Console.WriteLine(error.Source);
    Console.WriteLine(error.Description);
}

foreach (var error in shipment.InternalErrors)
{
    Console.WriteLine(error);
}

Documentation

Credits

Originally forked from DotNetShipping by @kylewest. Package icon by Fredy Sujono.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.6 99 4/5/2026
4.0.4 113 3/22/2026
4.0.3 210 3/7/2026
4.0.2 105 3/4/2026
4.0.0 95 3/2/2026
3.0.0 875 12/7/2025
2.3.1.310 914 3/18/2025
2.3.0.305 2,084 3/2/2025
2.2.3.291 4,668 9/30/2024
2.2.2.285 375 9/11/2024
2.2.1.268 380 8/16/2024
2.2.0.261 312 8/9/2024
2.1.3.253 667 7/24/2024
2.1.2.242 413 7/10/2024
2.1.1.234 290 7/5/2024
2.1.0 305 6/30/2024
2.0.218-beta 199 6/4/2024
2.0.217-beta 206 5/30/2024
2.0.215-beta 2,846 5/10/2024
1.1.10.204 9,946 10/21/2023
Loading failed