If you create and use multi-currency Prices, Checkout can localize Prices depending on the location of your customers. This can reduce cart or order abandonnment and increase conversion.
To simulate a user's location you can compose a test email address that includes an ISO country code. For example if you would like to see the EUR currency being presented, you can use customer+location_IE@example.com where +location_XX XX represents the ISO country code.
The Price being passed in this demo is configured with a default currency of USD and a second currency option of EUR. Any other ISO country code for example MX for Mexico will use the default currency of the Price, in this case USD. Read more in the docs here.
Two test values to try:
fastify.post("/create-checkout-session", async (request, reply) => {
var sessionparams = {
...(request.body.email && { customer_email: request.body.email }),
line_items: [
{
price: process.env.price_id,
quantity: 1,
},
],
mode: "payment",
success_url: `${process.env.base_uri}?success=true`,
cancel_url: `${process.env.base_uri}/?cancel=true`,
};
var email = request.body["email"];
const session = await stripe.checkout.sessions.create(sessionparams);
reply.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: