Localized pricing means a price list in each market's currency that looks like a price someone chose. The rate gives you the raw number. Rounding rules give you the shown price. The example converts a 29 USD plan into five currencies and applies a price point per market.
Convert, then round to a price point
Request the rates for every market in one call. For each currency, round the raw price up to a step, then subtract to reach the ending you want. Euros and pounds end in .99, reais in .90, and yen and rupees round up to a hundred.
import json, math, urllib.requestdef get(path): return json.load(urllib.request.urlopen(f"https://api.exchangerate.dev/v1/{path}"))base_usd = 29rates = get("latest/USD?symbols=EUR,GBP,JPY,BRL,INR")["rates"]ENDINGS = {"EUR": 0.99, "GBP": 0.99, "JPY": 0, "BRL": 0.9, "INR": 0} # price point per currencySTEP = {"JPY": 100, "INR": 100} # round up to this step firstfor ccy, rate in rates.items(): raw = base_usd * rate if ccy in STEP: price = math.ceil(raw / STEP[ccy]) * STEP[ccy] - ENDINGS[ccy] else: price = math.ceil(raw) - 1 + ENDINGS[ccy] print(f"{ccy}: raw {raw:,.2f} -> shown {price:,.2f}")EUR: raw 25.89 -> shown 25.99GBP: raw 21.63 -> shown 21.99JPY: raw 4,580.75 -> shown 4,600.00BRL: raw 157.80 -> shown 157.90INR: raw 2,750.97 -> shown 2,800.00The shown price sits slightly above or below the raw conversion: 25.99 against 25.89 for euros, 4,600 against 4,580.75 for yen. Decide the direction once and apply it to every market.
Refresh prices only when the rates move
A price list that changes every minute confuses customers and breaks cached pages. Recompute the list on a schedule, such as weekly, and publish a new price only when the raw conversion has moved by more than a threshold you pick against the price now live. Keep the live price otherwise.
Store the price you charge
Save the shown price with the order, in the market's currency. A refund or an invoice then uses the amount the customer saw, whatever the rate does afterwards. The rate feeds the price list. The order keeps its own price.
What it costs in requests
A weekly refresh of 5 currencies is one request a week. Even a refresh every hour is 720 requests a month, a fraction of the 5,000 included in the Free plan. Commercial use is allowed on Free with a visible, linked credit.
Prices that include VAT or sales tax depend on rules in each country. The rate conversion gives you the pre-tax number only.