See the code behind this demo!

Custom text with Stripe Checkout

Present additional text to customers when they purchase with Stripe Checkout.

Create your Checkout Session

Create a Checkout Session to configure what your customer sees on the hosted payment page. You can pass the optional custom_text hash to add custom text sections. Learn more about this feature here.

          
            const session = await stripe.checkout.sessions.create({
              cancel_url: 'https://stripe.com/cancel',
              custom_text: {
                shipping_address: {
                  message: "This text will appear below the shipping address fields on the payment page"
                },
                submit: {
                  message: "This text will appear above the submit button on the payment page"
                }
              },
              mode: 'payment',
              line_items: [{
                price: 'price_xyz',
                quantity: 1
              }],
              shipping_address_collection: {
                allowed_countries: ['US']
              },
              success_url: 'https://stripe.com/success'
            })                   
          
        

Redirect your customer to the payment page

After successfully creating a Checkout Session, redirect your customer to the url field returned in the API response.

          
            res.redirect(session.url)
          
        

Demo

Console

> Ready ...

Experiment and learn

Make copies, remix, change and learn how to play with this tinydemo.


Any questions?

Reach out to us on any of our contact channels: