# Customize redirect behavior Display a confirmation page with your customer's order information. # Full hosted page If you have a Checkout integration that uses a hosted page, Stripe redirects your customer to a success page that you create and host on your site. You can use the details from a [Checkout Session](https://docs.stripe.com/api/checkout/sessions.md) to display an order confirmation page for your customer (for example, their name or payment amount) after the payment. ## Redirect customers to a success page To use the details from a Checkout Session: 1. Modify the [success_url](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-success_url) to pass the Checkout Session ID to the client side. 1. Look up the Checkout Session using the ID on your success page. 1. Use the Checkout Session to customize what’s displayed on your success page. > #### Webhooks are required for fulfillment > > You can’t rely on triggering fulfillment only from your checkout landing page, because your customers aren’t guaranteed to visit that page. For example, someone can pay successfully and then lose their connection to the internet before your landing page loads. > > [Set up a webhook event handler](https://docs.stripe.com/checkout/fulfillment.md?payment-ui=stripe-hosted#create-payment-event-handler) so Stripe can send payment events directly to your server, bypassing the client entirely. Webhooks provide the most reliable way to confirm when you get paid. If webhook event delivery fails, Stripe [retries multiple times](https://docs.stripe.com/webhooks.md#automatic-retries). ## Modify the success URL (Server-side) Add the `{CHECKOUT_SESSION_ID}` template variable to the `success_url` when you create the Checkout Session. This is a literal string and you must add it exactly as you see it here. Don’t substitute it with a Checkout Session ID—this happens automatically after your customer pays and is redirected to the success page. #### Node.js ```javascript const session = await stripe.checkout.sessions.create({success_url: "http://yoursite.com/order/success?session_id={CHECKOUT_SESSION_ID}", // other options..., }); ``` ## Create the success page (Server-side) 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: #### Accounts v2 #### Node.js ```javascript // This example sets up an endpoint using the Express framework. const express = require('express'); const app = express(); // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. const stripe = require('stripe')('<>'); app.get('/order/success', async (req, res) => {const session = await stripe.checkout.sessions.retrieve(req.query.session_id); const customer_account = await stripe.v2.core.accounts.retrieve(session.customer_account); res.send(`

Thanks for your order, ${customer_account.display_name}!

`); }); app.listen(4242, () => console.log(`Listening on port ${4242}!`)); ``` #### Customers v1 #### Node.js ```javascript // This example sets up an endpoint using the Express framework. const express = require('express'); const app = express(); // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. const stripe = require('stripe')('<>'); app.get('/order/success', async (req, res) => {const session = await stripe.checkout.sessions.retrieve(req.query.session_id); const customer = await stripe.customers.retrieve(session.customer); res.send(`

Thanks for your order, ${customer.name}!

`); }); app.listen(4242, () => console.log(`Listening on port ${4242}!`)); ``` ## Test the integration To confirm that your redirect is working as expected: 1. Click the checkout button. 1. Fill in the customer name and other payment details. 1. Click **Pay**. If it works, you’re redirected to the success page with your custom message. For example, if you used the message in the code samples, the success page displays this message: **Thanks for your order, Jenny Rosen!**