Dealing with prices and currencies.

By Filippo Conforti on February 28, 2023

When it comes to buying and selling products or services, the price is a central component of the transaction. It is the value assigned to a particular item or service that customers will pay in exchange for it.

A price is made up of two distinct parts. The first part is the amount, which represents the numerical value of the price. The second part is the currency, which represents the unit of measurement for the price.

A price is made up of an amount and a currency.
A price is made up of an amount and a currency.

There are currently 180 currencies circulating in 197 countries. Although it is theoretically possible to sell worldwide using a single currency, customers prefer to view and pay in their own currency. Therefore, it's essential to support as many local currencies as possible to improve the customer experience and increase the likelihood of completing a purchase.

Ecommerce platforms often rely on currency conversions to provide multicurrency capabilities. This involves setting a base price and then calculating a localized price based on the current exchange rate. This approach has many limitations and costs. Additionally, it is not feasible when you want to offer different price amounts for the same currency. A much better approach is to manage multiple price lists in different currencies and gain full control over your international pricing strategy.

Why converting prices is a bad idea

Currency conversions are governed by exchange rates, which are the rates at which one currency will be exchanged for another. Global trade markets cause exchange rates to fluctuate regularly. As I write, the USD/EUR exchange rate is 0.94, which means that $1.00 USD is traded for €0.94 EUR. Banks and credit card companies often charge currency conversion fees when customers make purchases using foreign currencies, which can either be a percentage of the price amount or a flat fee.

Consider a scenario in which a US merchant sells a shirt to a European customer for $100.00 and offers the option of paying in EUR. At today's exchange rate, the customer will pay 94.00€ plus, let’s say, a flat conversion fee of 1.00€. Today's final price would be 95.00€. The exchange rate could fluctuate to 0.92 or 0.96 tomorrow, resulting in a final price of 93.00€ or 97.00€ for the same t-shirt.

Option 1: the customer absorbs currency fluctuations.
Option 1: the customer absorbs currency fluctuations.

So, the merchant will get the same $100.00, but prices will change daily on its website, causing a bad user experience. In addition, if the customer returns the t-shirt, the $100.00 refund will be converted again. A different amount will likely be refunded to the customer. Some countries consider this illegal. Anyhow, not only did the customer dislike the t-shirt, but also the customer service experience. That customer will never shop with that brand again.

In order to avoid price fluctuations and such a bad customer experience, a merchant might expose fixed prices on their website, absorbing exchange rate fluctuations and conversion fees. In the same example as above, the merchant might expose a fixed price of, say, 95.00€. A sale of that t-shirt might result in $99.49 one day. After a day or two, the same sale might yield $97.28 or $101.37. Which is totally unpredictable.

Option 2: the merchant absorbs currency fluctuations.
Option 2: the merchant absorbs currency fluctuations.

The fluctuations can result in either a profit or a loss. Regardless, there are currency risks associated with every transaction, which your Finance department would like to avoid.

The right way to do multicurrency

In order to sell internationally without providing a bad customer experience or incurring in currency risks is to handle multiple independent price lists in multiple currencies. Each market can be mapped to a specific price list. More markets can share the same price list and it must be possible to manage two or more price lists for the same currency.

Mapping multiple markets to multiple price lists and currencies.
Mapping multiple markets to multiple price lists and currencies.

In some cases, it might be convenient to have a base price list from which the others can be derived based on currency exchange rates. However, it is important that your Finance department controls the exchange rate to avoid random fluctuations caused by global trade markets.

If you want to accept payments in a foreign currency, your payment gateway must support that currency, and be connected to a bank account that accepts it as well. In addition, your commerce platform must permit you to connect different payment gateways (or different merchant accounts from the same gateway) to different markets, otherwise you will have to clone your store for each market.

Many ecommerce platforms offer this workaround as a way to overcome their core limitations. Despite being acceptable for supporting two or three markets, this approach causes data duplication and costs to explode and is not a scalable solution.

Storing and displaying prices

Some currencies have two decimals, some have three, and some have none. It is the number of decimals of a currency that determines its exponent. A minor unit is, instead, the smallest unit of a currency. You must multiply a price amount by its currency exponent if you want to express it in minor units.

USD currency, for example, has a 2 exponent, which means that 10 USD are 1,000 in minor units. In contrast, JPY currency has no exponent, which means that 10 JPY in minor units is still 10.

It is important to store prices in minor units in a database, rather than customer-friendly formats. The reason for doing so is that you want to make sure that rounding errors are avoided when calculating prices. When it comes to display prices, you’ll need to convert the amount based on the currency exponent and display the price using the currency symbol and formatting rules.

The ISO 4217 standard defines alpha and numeric codes for currency representation and provides information about specific currencies' relationships with their minor units. The csv file below is an extract I made from Commerce Layer’s internal code base. The file contains all currencies, along with their exponents and symbols. Feel free to download and share this file at your convenience.

What about cryptos?

Cryptocurrencies are digital currencies based on blockchain technology. For the purposes of this article, keep in mind that if you want to accept Bitcoin, Ethereum, or other cryptos, you’ll need a payment gateway that supports them.

Further, these currencies generally have very large exponents. For example, one Bitcoin is divisible to eight decimal places (100 millionths of one bitcoin), which means the Bitcoin has an exponent of 8. As a matter of curiosity, the Bitcoin minor unit is called a satoshi, honoring Satoshi Nakamoto, the person (or persons) believed to have developed the currency.

Another popular cryptocurrency, Ethereum, has an even larger exponent, 18. Therefore, when dealing with cryptocurrencies, price minor units can be very large numbers. Make sure your database field type is a BIGINT and the variable type in your programming language supports this level of precision as well.

Enjoy the reading?

Subscribe to the newsletter and get a new article delivered to your inbox every week.