Skip to content
Create account or Sign in
The Stripe Docs logo
/
Ask AI
Create accountSign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
APIs & SDKsHelp
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseUse Managed Payments
Use Payment Links
Use a prebuilt checkout page
Build a custom integration with Elements
    Overview
    Quickstart guides
    Stripe Elements
    Compare Checkout Sessions and PaymentIntents
    Design an advanced integration
    Customize look and feel
    Manage payment methods
    Collect additional information
      Collect physical addresses and phone numbers
      Customize billing details collection
      Charge for shipping
    Build a subscriptions integration
    Dynamic updates
    Add discounts
    Collect taxes on your payments
    Redeem credits
    Let customers pay in their local currency
    Save and retrieve customer payment methods
    Send receipts and paid invoices
    Manually approve payments on your server
    Authorize and capture a payment separately
    Elements with Checkout Sessions API beta changelog
Build an in-app integration
In-person payments
Terminal
Payment methods
Add payment methods
Manage payment methods
Faster checkout with Link
Payment scenarios
Handle multiple currencies
Custom payment flows
Flexible acquiring
Orchestration
Beyond payments
Incorporate your company
Crypto
Agentic commerce
Financial Connections
Climate
Understand fraud
Radar fraud protection
Manage disputes
Verify identities
United States
English (United States)
HomePaymentsBuild a custom integration with ElementsCollect additional information

Charge for shipping

Create different shipping rates for your customers.

Shipping rates let you display various shipping options, such as standard, express, and overnight, with more accurate delivery estimates. Charge your customer for shipping using different Stripe products. Before you create a shipping rate, learn how to collect billing and shipping addresses.

Note

Shipping rates only support fixed amount values for the entire order. You can’t adjust the shipping rate based on the number of items in the order.

Create a shipping rate
Server-side

Shipping rates only support fixed amount values for the entire order. You can’t adjust the shipping rate based on the number of items in the order.

To add a shipping rate using the Dashboard:

  1. Click Create shipping rate.
  2. Enter an amount, a description, and an optional delivery estimate.
  3. Click Save, and copy the shipping rate ID (shr_123456).

Enter your shipping rate details

Update a shipping rate

You can’t update a shipping rate in the Dashboard. To update a shipping rate in the Dashboard, you must archive the shipping rate and then create a new one.

Archive a shipping rate

To archive a shipping rate:

  1. On the Shipping rates tab, select the applicable shipping rate.
  2. Click the overflow menu , and select Archive.

To unarchive the shipping rate, click the overflow menu , and select Unarchive shipping rate.

Create a Checkout Session
Server-side

To create a Checkout Session that includes your shipping rate, pass in the generated shipping rate ID to the shipping_options parameter. If you want to create the shipping rate at the same time as a Checkout Session, use the shipping_rate_data parameter with shipping_options. Only Checkout Sessions in payment mode support shipping options.

The following code sample adds two shipping options to the Checkout Session:

  • Free shipping, with an estimated delivery of 5-7 business days.
  • Next day air, at a cost of 15.00 USD, with an estimated delivery of exactly 1 business day.
Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d billing_address_collection=required \ -d "shipping_address_collection[allowed_countries][0]"=US \ -d "shipping_address_collection[allowed_countries][1]"=CA \ -d "shipping_options[0][shipping_rate_data][type]"=fixed_amount \ -d "shipping_options[0][shipping_rate_data][fixed_amount][amount]"=0 \ -d "shipping_options[0][shipping_rate_data][fixed_amount][currency]"=usd \ -d "shipping_options[0][shipping_rate_data][display_name]"="Free shipping" \ -d "shipping_options[0][shipping_rate_data][delivery_estimate][minimum][unit]"=business_day \ -d "shipping_options[0][shipping_rate_data][delivery_estimate][minimum][value]"=5 \ -d "shipping_options[0][shipping_rate_data][delivery_estimate][maximum][unit]"=business_day \ -d "shipping_options[0][shipping_rate_data][delivery_estimate][maximum][value]"=7 \ -d "shipping_options[1][shipping_rate_data][type]"=fixed_amount \ -d "shipping_options[1][shipping_rate_data][fixed_amount][amount]"=1500 \ -d "shipping_options[1][shipping_rate_data][fixed_amount][currency]"=usd \ -d "shipping_options[1][shipping_rate_data][display_name]"="Next day air" \ -d "shipping_options[1][shipping_rate_data][delivery_estimate][minimum][unit]"=business_day \ -d "shipping_options[1][shipping_rate_data][delivery_estimate][minimum][value]"=1 \ -d "shipping_options[1][shipping_rate_data][delivery_estimate][maximum][unit]"=business_day \ -d "shipping_options[1][shipping_rate_data][delivery_estimate][maximum][value]"=1 \ -d "line_items[0][price_data][currency]"=usd \ -d "line_items[0][price_data][product_data][name]"=T-shirt \ -d "line_items[0][price_data][unit_amount]"=2000 \ -d "line_items[0][quantity]"=1 \ -d mode=payment \ -d ui_mode=custom \ --data-urlencode return_url="https://example.com/return"

Collect the customer's shipping option
Client-side

On your client, use the shippingOptions object to render the available shipping options, such as in a radio button list. When your customer selects a shipping option, call updateShippingOption with the ID of the shipping option.

index.html
<div id="shipping-options"></div>
checkout.js
actions.getSession().shippingOptions.forEach((option) => { const form = document.createElement('form'); shippingOptions.forEach(option => { const label = document.createElement('label'); const radio = document.createElement('input'); radio.type = 'radio'; radio.id = option.id; radio.name = 'shippingOption'; radio.value = option.id; radio.addEventListener('click', () => { actions.updateShippingOption(option.id) }) const labelText = document.createTextNode(option.displayName); label.appendChild(radio); label.appendChild(labelText); form.appendChild(label); }); document.getElementById('shipping-options').appendChild(form); }); const shippingAddressElement = checkout.createShippingAddressElement(); shippingAddressElement.mount('#shipping-address');

OptionalHandle completed transactions

OptionalDefine a delivery estimate

OptionalCharge tax for shipping

Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc