Customize your success page
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:
- Modify the
success_url
to pass the Checkout Session ID to the client side. - Look up the Checkout Session using the ID on your success page.
- Use the Checkout Session to customize what’s displayed on your success page.
Modify the success URLServer-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.
Create the success pageServer-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:
Test the integration
- Click your checkout button and fill in the customer name (for example, “Jenny Rosen”) and the remaining payment details.
- Click Pay.
You should be redirected to the success page, and see Thanks for your order, Jenny Rosen!