Sign in
An image of the Stripe logo
Create account
Sign in
Home
Payments
Business operations
Financial services
Developer tools
Security
All products
Home
Payments
Business operations
Home
Payments
Business operations
Financial services
Developer tools
Support
Overview
Overview
How Checkout works
Quickstart
Fulfill your orders
Migrate payment methods to the Dashboard
Manage limited inventory
Migrate from legacy Checkout
Migrate Checkout to use Prices
Additional features
Add discounts
Add shipping
Make line item quantities adjustable
Collect taxes
Collect tax IDs
Collect phone numbers
Customize your integration
Customize success page
Configure subscription upsells
Configure cross-sells
Recover abandoned carts
Collect consent for promotional emails
Analyze conversion funnel
Embed a pricing table (Beta)
Start a free trial without collecting payment details (Beta)
Testing
No-code options
checkout
·
HomePayments

Customize your success page

Learn how to display a confirmation page with your customer's order information.

First build an integration to accept a payment with Checkout before using this guide.

You can use the details from a Checkout Session to display an order confirmation page for your customer (for example, their name or payment amount) after the payment. To use the details from a Checkout Session:

  1. Modify the success_url to pass the Checkout Session ID to the client side.
  2. Look up the Checkout Session using the ID on your success page.
  3. Use the Checkout Session to customize what’s displayed on your success page.

Modify the success URL
Server-side

Add the {CHECKOUT_SESSION_ID} template variable to the success_url when you create the Checkout Session. Note that this is a literal string and must be added exactly as you see it here. Do not substitute it with a Checkout Session ID—this happens automatically after your customer pays and is redirected to the success page.

session = Stripe::Checkout::Session.create( success_url: "http://yoursite.com/order/success", success_url: "http://yoursite.com/order/success?session_id={CHECKOUT_SESSION_ID}", # other options..., )

Create the success page
Server-side

Next, look up the Checkout Session using the ID and create a success page to display the order information. This example prints out the customer’s name:

# This example sets up an endpoint using the Sinatra framework. # Watch this video to get started: https://youtu.be/8aA9Enb8NVc. # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key =
'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
require 'sinatra' get '/order/success' do session = Stripe::Checkout::Session.retrieve(params[:session_id]) customer = Stripe::Customer.retrieve(session.customer) "<html><body><h1>Thanks for your order, #{{customer.name}}!</h1></body></html>" end

Test the integration

  1. Click your checkout button and fill in the customer name (for example, “Jenny Rosen”) and the remaining payment details.
  2. Click Pay.

You should be redirected to the success page, and see Thanks for your order, Jenny Rosen!

Was this page helpful?
Questions? Contact us.
View developer tutorials on YouTube.
Check out our product changelog.
Powered by Markdoc
You can unsubscribe at any time. Read our privacy policy.
On this page
Modify the success URL
Create the success page
Test the integration
Stripe Shell
Test mode
▗▄ ▄▟█ █▀▀ ▗▟████▙▖ ██████ ███▗▟█ ███ ███▗▟██▙▖ ▗▟█████▙▖ ███▖ ▀▀ ███ ███▀▀▀ ███ ███▀ ███ ███ ███ ▝▜████▙▖ ███ ███ ███ ███ ███ █████████ ▄▄ ▝███ ███ ▄ ███ ███ ███▄ ███ ███ ▄▄ ▝▜████▛▘ ▝▜███▛ ███ ███ ███▝▜██▛▘ ▝▜█████▛▘ ███ ▀▘
Welcome to the Stripe Shell! This is a graphical user interface of the Stripe CLI. You can use it to discover webhook events and manage your Stripe resources. By pressing ctrl + ` you can toggle it open from any page within the Stripe documentation. - View supported commands: - Listen for webhook events: - Trigger webhook events: - Call Stripe APIs: stripe [api resource] [api operation] (e.g. )
The Stripe Shell is best experienced on desktop.
$