Use the exchange rate API to convert your shop's base prices into the currencies you display to customers. Rates update about every 60 seconds on trading days, with a 15 minute delay on Free.
Get rates for your shop's base currency
GET /v1/latest/USD?symbols=EUR,GBP,JPY returns rates for a USD base in one call. The curl example shows how to request the currencies your shop displays.
Use GET /v1/convert/{FROM}/{TO}/{AMOUNT} to convert an amount between currencies.
curl "https://api.exchangerate.dev/v1/latest/USD?symbols=EUR,GBP,JPY" \ -H "X-API-Key: $EXCHANGERATE_API_KEY"Fetch on the server and cache the rates
Fetch rates on your server, cache them and refresh them on a schedule. Use the cached rates for page views so each customer visit does not trigger a request.
Round prices for each currency
Convert the base price, then round to your shop's price endings for that currency. The JavaScript example uses showPrice(amountUsd, currency, rates) to show a converted price.
// rates: the cached answer's rates, units of each currency per US dollar ({ EUR: …, GBP: …, JPY: … }).function showPrice(amountUsd, currency, rates) { const amount = currency === 'USD' ? amountUsd : amountUsd * rates[currency] const digits = new Intl.NumberFormat('en', { style: 'currency', currency }).resolvedOptions().maximumFractionDigits // Round up to the currency's smallest unit; apply your own price endings here. const rounded = Math.ceil(amount * 10 ** digits) / 10 ** digits return new Intl.NumberFormat(undefined, { style: 'currency', currency }).format(rounded)}Keep the rate used for each order
Store the exchange rate and the time used on each order. This records how you calculated the price when rates change later.
Decide which currency checkout charges
Decide whether checkout charges in the currency shown to the customer or in your shop's base currency. Make that choice clear before the customer pays.
For platform guidance, see Shopify and WooCommerce, or start with the currency converter API.