Showing prices in the visitor's own currency reduces friction and lifts conversion. IP geolocation lets you do it instantly, on first load, with no user input. Here's how to implement it well.
The basic flow
- Resolve the visitor's IP to a country.
- Map the country to its currency (detectip.ai returns the currency code and symbol directly).
- Display prices in that currency, with a manual override.
fetch("/v1/myip").then(r=>r.json()).then(d => {
setCurrency(d.currency, d.currency_symbol); // e.g. "EUR", "€"
});
Important: display vs charge
Localized display currency is a UX win. Charging in another currency needs real FX rates and payment support — don't hard-convert prices with a stale rate. A common pattern: show local currency as "approximately", charge in your base currency, or integrate a proper FX/payment provider for true multi-currency.
Handle the edge cases
- VPN/proxy: the country may be masked — let users switch, and don't lock pricing to a guessed location.
- Eurozone & shared currencies: many countries share a currency; map carefully.
- Persistence: remember the user's explicit choice (cookie/localStorage).
Why pair with threat detection
If you ever price differently by region, masked locations become an abuse vector. detectip.ai returns the currency and a proxy/VPN flag, so you can localize confidently. See personalization.
FAQ
Can I auto-charge in local currency? Only with real FX + payment support; otherwise localize display and charge in base currency.
What if the currency guess is wrong? Always offer a switcher. Start free with a key.