We have partnered with Shippo to automatically calculate shipping costs for the Orders API. The Orders API allows users to represent their inventory and orders within Stripe, rather than on their own site or through a third-party. If you are not yet familiar with the Orders API, we recommend that you first visit the Orders API Overview documentation before diving into shipping cost calculations.
There are two steps to enable dynamic shipping cost calculations for your orders:
Step 1: Create your Shippo account
To create your Shippo account follow these steps:
- Sign up for a Shippo account. After signing up you will be taken to the Shippo dashboard
- On the navigation bar click Connect to open up the list of available integrations
- Click Edit button next to Stripe.
- Copy the URL shown, you will need this URL to activate Shippo in Stripe
By default, Shippo will use USPS and DHL to calculate shipping rates. If you would like to use another carrier, you can configure additional options under Carriers in the Shippo dashboard. You will need to create an account with the carrier before you can set up the account in Shippo. For a full list of supported carriers, please see the Shippo carrier listings.
A recommended, but optional step is to add different the flat-rate options you use for shipping. On the navigation bar in your Shippo dashboard, click on Settings, and add your boxes sizes by clicking Add Package. Adding a default box size allows Shippo to use this as a fallback for calculating shipping costs in case no other rates are available.
Step 2: Activate Shippo in Stripe
To activate Shippo in your Stripe account:
- Log into your Stripe account and navigate to the Relay settings
- Choose Live mode under Settings, then click Change shipping next to the Shipping setting
- Choose Provider under Type and Shippo under Provider
- Enter your full Shippo Stripe URL (it should start with https://api.goshippo.com/stripe) into the Shippo URL field in the form. (This is the URL you found on the Shippo API page.)
- Fill out the From address with the address you will be shipping orders from. Shippo will use this address as the source address when calculating shipping costs.
- Click Update to save your credentials
If you want to test your Shippo integration before applying it to your production orders, simply change your Orders test mode settings by picking Test mode in the Orders settings dropdown menu and entering your Shippo URL as described above. Shippo uses the same URL for test and live mode as there is no charge to get shipping rates.
Shippo supports both a test and a live mode for calculating shipping rates. If you want to test your integration, you can simply change your Orders test mode settings by picking Test mode in the Orders settings dropdown menu. You can repeat the steps above using your Shippo Test Secret API Key to set up a test mode connection.
After completing these two steps, Stripe will automatically use your Shippo credentials to calculate shipping costs for orders you place through the Orders API.
Shippo does not attempt to calculate any kind of “optimal box” for an order with multiple SKUs. Instead Shippo allows you to set a default box in the Shippo dashboard. Setting a default shipping box size lets you control how carriers calculate rates without explicitly sending item sizes with each call. Shippo will use the length, width and height of this default package to retrieve ratings from the carriers. If you don’t have a default package set, Shippo will use a 10”x10”x10” in box.
Shippo does use the combined weight of your SKUs when calculating shipping rates. It is therefore important that your products have an accurate weight in Stripe. If your SKUs don’t have a weight set, Shippo will not be able to return rates. You can set this from the Dashboard or the Stripe API as described in the shipping integration overview.
As an example, if your default box size on Shippo is set to 5”x10”x10” and you are ordering two SKUs that each weigh 10oz, Shippo will retrieve rates for 5”x10”x10” package weighing 20oz.