DEV Community

Cover image for Localized Prices with Checkout
mattling_dev for Stripe

Posted on

Localized Prices with Checkout

Intro

When going through a checkout flow, prospective customers may abandon their cart or order when they see a currency different from their local currency. That can be for a number of reasons. It might be unclear to the customer about the exchange fee implications or whether they might incur extra bank fees when paying in different currencies.

Now with Checkout and Payment Links, you can use multi-currency Prices to present your customers’ local currency which can help to lower abandonment and increase conversion.

Checkout automatically localizes prices if you’re using multi-currency Prices depending on your customers’ location. You can create multi-currency Prices via the Dashboard and the API.

What you’ll learn

In this demo we’ll create a multi-currency Price in the Dashboard and then we’ll demonstrate how to create and test a Checkout Session that will present a different currency to your customers, based on their location.

If you’d like to learn more about Checkout, see the list of videos here on our StripeDevelopers YouTube channel.

Create a multi-currency Price

We'll add a new Product in the Dashboard. Now in the Price Information section, there is an option to "+Add more currencies".

The default price is 10 euros for customers in the EU, and we'll add a second price in USD. Stripe will make a suggestion of the USD price based on current exchange rates but you're free to choose your own amount.

Create a Product and multi-currency Price

We’ll copy the Price ID for use later when creating the Checkout Session.

Copy the Price ID

Creating a Checkout Session

Next, we’ll create a Checkout Session with this Price ID, this example is written in Ruby:

session = Stripe::Checkout::Session.create({
  payment_method_types: ['card'],
  line_items: [{
    price: 'price_1LzMQyJyGOmgcJwrvQy3bCLq',
    quantity: 1,
  }],
  mode: 'payment',
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
  customer_email: 'test+location_FR@example.com'
})

puts session.url
Enter fullscreen mode Exit fullscreen mode

Notice that we’ve provided a test email address of the form test+location_FR.example.com. This is how we can simulate that customers are arriving at your checkout from different countries. If we change the FR part to another ISO country code, we can force Checkout to test the currency for that particular country if one is configured for the Price.

We’ll run this code and grab the URL output to the console:

https://checkout.stripe.com/c/pay/cs_test_a1U3DAWuKb0QgD33ObzV5riXIzrqzRqtcNLcqbtL3znXXLGU5DA5rA7Kwb#fidkdWxOYHwnPyd1blpxYHZxWjA0SW9vQW5PfEJKaGJmT3J3Q2ZSYjFuTGpsTHVxUUtKMG9cazNhalR2VnE0QzFkbzdWRmdDQDIyQHM0V1F9PWdnPENOd1FWfHV0XUpwPGByczdkVnQ9PWhLNTVuNzJXdEZoTCcpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl
Enter fullscreen mode Exit fullscreen mode

If we follow this URL, we can see that the currency in EUR is displayed for a french customer:

Currency localized to EU

Now, let’s change our Checkout Session to simulate a customer arriving from the US:

session = Stripe::Checkout::Session.create({
  payment_method_types: ['card'],
  line_items: [{
    price: 'price_1LzMQyJyGOmgcJwrvQy3bCLq',
    quantity: 1,
  }],
  mode: 'payment',
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
  customer_email: 'test+location_US@example.com'
})

puts session.url
Enter fullscreen mode Exit fullscreen mode

The only change that we’ve made is to change the ISO country code in the customer email address to US.

https://checkout.stripe.com/c/pay/cs_test_a1vwLfWUcoaUrxJmWR1vimzsZw7D2cuqWhl1mcmPsb8Y2CXs8MvBDUVVaZ#fidkdWxOYHwnPyd1blpxYHZxWjA0SW9vQW5PfEJKaGJmT3J3Q2ZSYjFuTGpsTHVxUUtKMG9cazNhalR2VnE0QzFkbzdWRmdDQDIyQHM0V1F9PWdnPENOd1FWfHV0XUpwPGByczdkVnQ9PWhLNTVuNzJXdEZoTCcpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl
Enter fullscreen mode Exit fullscreen mode

If we follow this new session URL, we'll see that the local currency is presented in USD:

Currency localized to US

Combining with Coupons, Stripe Tax and more

Localized pricing works with Coupons, Stripe Tax, and Shipping Rates. Depending on the combination of features that you’re using, you’ll need to make sure that the according currency options are set on those features as well. You can see a list of rules here.

Summary

Presenting your customers prices in their local currency will reduce cart abandonment and increase conversion rates. Now with Checkout and Payment Links you can easily support multi-currency Prices by creating them via the Dashboard or API to improve the user experience for your customers.

About the author

Matthew Ling

Matthew Ling (@mattling_dev) is a Developer Advocate at Stripe. Matt loves to tinker with new technology, adores Ruby and coffee and also moonlighted as a pro music photographer. His photo site is at matthewling.com and developer site is at mattling.dev.

Stay connected

In addition, you can stay up to date with Stripe in a few ways:

📣 Follow us on Twitter
💬 Join the official Discord server
📺 Subscribe to our Youtube channel
📧 Sign up for the Dev Digest

Top comments (0)