Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
    Overview
    Quickstarts
    Customise look and feel
    Collect additional information
    Collect taxes
    Dynamically update checkout
    Manage your product catalogue
    Subscriptions
    Manage payment methods
    Let customers pay in their local currency
    Add discounts, upsells, and optional items
    Set up future payments
    Save payment details during payment
    Manually approve payments on your server
    After the payment
      Fulfil orders
      Send receipts and paid invoices
      Customise redirect behaviour
      Recover abandoned carts
      Analyse conversion funnel
    Elements with Checkout Sessions API beta changelog
    Migrate from legacy Checkout
    Migrate Checkout to use Prices
Build an advanced integration
Build an in-app integration
Payment Methods
Add payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Other Stripe products
Financial Connections
Crypto
Climate
HomePaymentsBuild a checkout pageAfter the payment

Customise redirect behaviour

Display a confirmation page with your customer's order information.

Copy page

You can customise how and whether Stripe redirects your customers after they complete payment. You can make Stripe always redirect customers or only redirect for some payment methods.

To set up redirects, specify the return page:

  • In the return_url when you create the Checkout Session on your server
  • In the returnUrl when you confirm the Checkout Session on the client.

Or you can redirect customers only if the payment method requires it (for example, a bank authorisation page for a debit-based method).

Redirect customers to a return page

When you create the Checkout Session, specify the URL of the return page in the return_url. You can add the {CHECKOUT_SESSION_ID} template variable to the return_url to include the ID of the completed Checkout Session. This is a literal string and you must add it exactly as you see here. Don’t substitute it with a Checkout Session ID, which happens automatically after your customer pays and is redirected to the return page.

Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -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?session_id={CHECKOUT_SESSION_ID}"

Redirect-based payment methods

During payment, some payment methods redirect the customer to an intermediate page, such as a bank authorisation page. When they complete that page, Stripe redirects them to your return page.

To only redirect the customer to your return page if they’re redirected to an intermediate page, set redirect: 'if_required' when you confirm the Checkout Session.

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