We have partnered with EasyPost 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 Relay, we recommend that you first visit the Orders API Overview documentation before diving into shipping cost calculations.
To enable dynamic shipping cost calculations for your orders, simply:
After doing so, you can learn how to automatically generate shipping labels for your Stripe orders.
Step 1: Create your EasyPost account
If you don’t already have an EasyPost account, create one by registering at the EasyPost Sign-up Page. After creating the account and verifying your email, you can log in to your account to retrieve your API keys. From the EasyPost dashboard click the API Keys link in the left sidebar to find your keys. You will need these to activate EasyPost in Stripe.
By default, EasyPost will use USPS to calculate shipping rates. If you would like to use another carrier, you can configure additional options under Carrier Accounts in the EasyPost dashboard. Note that you will need to create an account with the carrier before you can set up the account in EasyPost. For example, you will need to set up a UPS account and store those credentials with EasyPost before you can get UPS estimates for the Orders API via EasyPost. For more information, please see the EasyPost carrier guides.
Step 2: Activate EasyPost in Stripe
To activate EasyPost in your Stripe account:
- Log into your Stripe Dashboard and navigate to the Orders Settings.
- Choose Live mode under Settings, then click Change shipping next to the Shipping setting.
- Choose Provider under Type and EasyPost under Provider.
- Enter your production API key into the fields in the form. (This is the key you found in the EasyPost dashboard.)
- Fill out the From address with the address you will be shipping orders from. EasyPost will use this address as the source address when calculating shipping costs.
- Click Update to save your credentials.
EasyPost 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. You can repeat the steps above using your EasyPost Test Secret API Key to set up a test mode connection.
After completing these two steps, Stripe will automatically use your EasyPost credentials to calculate shipping costs for your Orders orders.
In addition to calculating shipping rates, EasyPost supports purchasing and printing shipping labels for your orders. You can follow EasyPost’s integration guide to learn how to automatically fulfill and purchase shipping labels for your Stripe orders.