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'
})
After successfully creating a Checkout Session, redirect your customer to the url
field returned in the API response.
res.redirect(session.url)
Make copies, remix, change and learn how to play with this tinydemo.
Reach out to us on any of our contact channels: