Currency API for Ecommerce — Multi-Currency Checkouts
Add live multi-currency pricing to your store. AllRatesToday provides real-time mid-market exchange rates for Shopify, WooCommerce, custom carts, and headless commerce.
Selling internationally? Showing customers prices in their local currency lifts conversion — but only if the rates are fresh. AllRatesToday gives you a real-time mid-market exchange-rate API that drops cleanly into any storefront, headless commerce setup, or custom cart.
Where it fits in your stack
- Shopify (custom theme / Hydrogen): call from a Liquid section or Hydrogen route.
- WooCommerce: use a small PHP helper to refresh rates daily into options table.
- Headless commerce (Next.js, Nuxt, Remix, Astro): fetch on the server with caching.
- Custom Node/Rails carts: wrap behind a service object with a 60-second cache.
The pattern that works
- Detect the visitor's currency (geo, browser locale, or cookie).
- Fetch
/v1/rates?source=YOUR_BASE&target=EUR,GBP,...once per cache window (60s–5min). - Display all prices client-side using the cached rate map.
- At checkout, charge in your store's base currency. Display the converted amount as a "guide" — your payment processor handles final FX.
Code: a Next.js server route
// app/api/rates/route.ts (Next.js App Router)
import { NextResponse } from 'next/server';
import AllRatesToday from '@allratestoday/sdk';
const client = new AllRatesToday({ apiKey: process.env.ALLRATES_API_KEY });
export const revalidate = 60; // cache for 60s
export async function GET() {
const data = await client.latest({
base: 'USD',
symbols: ['EUR', 'GBP', 'JPY', 'CAD', 'AUD'],
});
return NextResponse.json(data);
} Code: a Shopify Liquid + JS pattern
<!-- shopify section: currency-switcher.liquid -->
<script>
fetch('/apps/proxy/rates') // your app proxy hits AllRatesToday
.then(r => r.json())
.then(({ rates }) => {
document.querySelectorAll('[data-price-usd]').forEach(el => {
const usd = parseFloat(el.dataset.priceUsd);
const cur = window.SHOP_CURRENCY;
el.textContent = (usd * rates[cur]).toFixed(2) + ' ' + cur;
});
});
</script> Why ecommerce teams pick AllRatesToday
- Real-time — visitors see today's rate, not yesterday's snapshot.
- HTTPS-first — works from browser code without proxying.
- Predictable pricing — €4.99–€49.99/mo plans match real cart traffic.
- 160+ currencies — covers every market your shipping covers.
FAQ
Do I need to charge in the buyer's currency?
Not necessarily. Many stores display in local currency but settle in their base currency, letting the payment processor handle conversion at the card network rate.
How often should I refresh rates for ecommerce?
60 seconds to 5 minutes is plenty for display purposes. Mid-market rates don't move enough between page views to justify per-request fetches.
Can it handle Black Friday traffic?
With proper caching, even our Small plan covers most stores. For very high traffic, the Large plan (100,000 req/mo) plus 5-minute caching scales to millions of page views.