Exchange Rates API for E-Commerce: How to Add Multi-Currency Pricing to Your Store

Reviewed by Madhushan, Fintech Developer — November 2026
Online shopping with laptop and shopping bags

Short answer: Fetch rates on your server on a schedule, cache them, convert your base prices, round for each currency, and lock the rate at checkout. Do not call the API on every page view: refreshing one base currency every 15 minutes uses about 2,880 requests a month, which fits the €4.99 Small plan. The API returns mid-market rates, and your payment processor settles at its own rate, so build in a small buffer. If you use Shopify Payments with Markets, Shopify already converts checkout prices, and an API is mainly useful for fixed prices you control.

If your store sells internationally but shows prices in a single currency, every overseas shopper has to work out the price for themselves before they buy.

The solution is multi-currency pricing, and the backbone of any multi-currency implementation is a reliable exchange rates API. This guide walks through everything you need to know to add real-time currency conversion to your online store, whether you are on Shopify, WooCommerce, or a custom-built platform.

Why Your Store Needs Live Exchange Rates

Before diving into implementation, let us be clear about why static conversion tables or monthly rate updates are not enough.

Currency markets move constantly. The EUR/USD pair can shift by 1-2% in a single day during volatile periods. If you are using rates from last week, you are either overcharging customers (losing sales) or undercharging them (losing margin).

Customer trust depends on accuracy. Savvy international shoppers will check your converted price against Google or their banking app. If your rate is noticeably off, it signals that your store is not trustworthy or sophisticated enough to handle their order properly.

Margin protection requires fresh data. For stores with thin margins, even a 0.5% rate discrepancy across hundreds of transactions adds up quickly. An exchange rates API that updates frequently keeps your pricing aligned with reality.

Choosing the Right Update Frequency

Not every store needs the same refresh rate. Here is how to think about it:

Store TypeRecommended Update FrequencyWhy
Digital products (SaaS, ebooks)Every 1-6 hoursLower margins on currency risk; customers compare less
Physical goods, standard shippingEvery 1-4 hoursFulfillment delay provides natural buffer
High-value electronics, luxuryEvery 15-60 minutesHigher price = higher absolute currency risk
Marketplace with instant payoutsEvery 1-5 minutesNeed rates close to settlement time
Travel bookings, financial servicesReal-time (60 seconds)Customers are rate-sensitive and comparison-shop actively

AllRatesToday's exchange rates API updates every 60 seconds, sourced from institutional foreign exchange market data and central banks. That gives you the flexibility to match any of these use cases without needing multiple data providers.

Integration Architecture Patterns

There are three common patterns for integrating an exchange rates API into an e-commerce platform. The right one depends on your traffic volume and infrastructure.

Pattern 1: Client-Side Conversion (Simple Stores)

Fetch rates periodically and convert prices in the browser using JavaScript. The browser should not call the keyed API directly (an API key in front-end code is public, and /api/v1/rates does not allow cross-origin browser calls), so add one small route on your backend that holds the key:

// server.js (Express): your backend holds the key
app.get('/api/fx', async (req, res) => {
  // No target = every currency for this source, returned as an array of rows
  const r = await fetch('https://allratestoday.com/api/v1/rates?source=USD', {
    headers: { 'Authorization': 'Bearer ' + process.env.ALLRATESTODAY_API_KEY }
  });
  const rows = await r.json(); // [{ rate, source, target, time }, ...]
  res.set('Cache-Control', 'public, max-age=60')
     .json(Object.fromEntries(rows.map(row => [row.target, row.rate])));
});

The page then reads rates from your own route:

// Browser: fetch rates once from your backend and cache them
async function getRates() {
  const response = await fetch('/api/fx');
  return response.json(); // { EUR: 0.891743, GBP: 0.750976, ... }
}

// Convert a price for display
function convertPrice(amountUSD, targetCurrency, rates) {
  const converted = amountUSD * rates[targetCurrency];
  return formatCurrency(converted, targetCurrency);
}

Pros: Simple to implement, only one small proxy route on the server.
Cons: Rates shown in the browser may differ from checkout rates.

Best for: Small stores with fewer than 50 products, content sites with price comparisons.

Pattern 2: Server-Side Caching (Most Stores)

Fetch rates on your server, cache them, and use the cached rates for all price calculations.

# Python/Django example
import requests
from django.core.cache import cache

def get_exchange_rates(base='USD'):
    cached = cache.get(f'fx_rates_{base}')
    if cached:
        return cached

    response = requests.get(
        f'https://allratestoday.com/api/v1/rates?source={base}',
        headers={'Authorization': 'Bearer YOUR_API_KEY'}
    )
    # The API returns a list of rows: [{"rate", "source", "target", "time"}, ...]
    rates = {row['target']: row['rate'] for row in response.json()}
    cache.set(f'fx_rates_{base}', rates, timeout=300)  # 5-minute cache
    return rates

def convert_product_price(price_usd, target_currency):
    rates = get_exchange_rates('USD')
    return round(price_usd * rates[target_currency], 2)

Pros: API key stays on the server, consistent rates across sessions, reduces API calls.
Cons: Requires server-side code, cache invalidation adds complexity.

Request budget: a 5-minute cache uses up to about 8,640 requests a month per base currency, which fits the Medium plan (10,000). A 15-minute cache uses about 2,880, which fits the Small plan (5,000).

Best for: Most e-commerce stores. This is the recommended approach for the majority of use cases.

Pattern 3: Pre-Computed Price Tables (High-Traffic Stores)

For stores with high traffic and large catalogs, pre-compute prices in all supported currencies on a schedule.

# Cron job that runs every 15 minutes
def update_all_prices():
    rates = get_exchange_rates('USD')
    target_currencies = ['EUR', 'GBP', 'JPY', 'CAD', 'AUD', 'CHF']

    for product in Product.objects.all():
        for currency in target_currencies:
            converted = apply_rounding_rules(
                product.price_usd * rates[currency],
                currency
            )
            ProductPrice.objects.update_or_create(
                product=product,
                currency=currency,
                defaults={'price': converted}
            )

Pros: Zero latency at page load, database-level price queries, no conversion logic in the request path.
Cons: Stale prices between updates, requires background job infrastructure.

Best for: Stores with 1,000+ products and millions of monthly page views.

Platform-Specific Integration Guides

Shopify

If you use Shopify Payments with Shopify Markets, Shopify already converts checkout prices at its own rates. An exchange rates API is useful when you want something Markets does not do, such as fixed market prices set from a rate and rounding rule you control.

Option A: Set a manual rate per market. You can do this in Settings → Markets, using a rate from AllRatesToday as your reference.

Option B: Sync fixed prices to a price list. A scheduled script can fetch rates from AllRatesToday and write fixed prices to a market's price list through the Admin API. Availability depends on your Shopify plan. Our Shopify integration guide has the code.

Key considerations for Shopify:

WooCommerce

WooCommerce offers more flexibility through plugins and custom code.

WooCommerce core sells in one currency, so multi-currency comes from a plugin such as WooCommerce Multilingual & Multicurrency (from WPML) or a currency switcher. Each plugin has its own way to set rates, so check its documentation for where a custom rate plugs in. This helper fetches and caches rates for you to call from there:

// functions.php - cached rate lookup for your currency plugin
function art_get_rate($from, $to) {
    $cache_key = 'allratestoday_rates_' . $from;
    $cached_rates = get_transient($cache_key);

    if (!$cached_rates) {
        $response = wp_remote_get(
            'https://allratestoday.com/api/v1/rates?source=' . $from,
            ['headers' => ['Authorization' => 'Bearer YOUR_API_KEY']]
        );
        $body = json_decode(wp_remote_retrieve_body($response), true);
        // Array of rows: [{rate, source, target, time}, ...] keyed here by target
        $cached_rates = array_column($body, 'rate', 'target');
        set_transient($cache_key, $cached_rates, 900); // 15 min
    }

    return $cached_rates[$to] ?? null;
}

For a complete example built on WooCommerce's price filters, see our WooCommerce currency API guide.

Custom Platforms

If you are building on a custom stack, you have full control. The server-side caching pattern (Pattern 2) is your best starting point. Here is a checklist:

Pricing Display Best Practices

Getting the conversion math right is only half the battle. How you display prices matters just as much.

Show the Local Currency Symbol Correctly

Different currencies have different conventions:

CurrencyCorrect FormatCommon Mistake
USD$99.9999.99$
EUR89,99 EUR or 89,99 €$89.99 EUR
JPY14,500 JPY or ¥14,500¥145.00 (wrong precision)
GBP£79.9979.99 GBP£
INR₹8,299.00Rs. 8299
BRLR$ 499,90$499.90 BRL

Use the Intl.NumberFormat API in JavaScript or equivalent libraries in your backend language to handle these correctly:

function formatCurrency(amount, currencyCode, locale = navigator.language) {
  // Intl applies each currency's standard decimals, so JPY and KRW get none
  return new Intl.NumberFormat(locale, {
    style: 'currency',
    currency: currencyCode
  }).format(amount);
}

Psychological Pricing Across Currencies

A product priced at $49.99 in USD should not display as EUR 44.2371 in Europe. Apply charm pricing rules after conversion:

def apply_charm_pricing(converted_price, currency):
    """Round to the nearest .99 or .95 for charm pricing."""
    if currency == 'JPY':
        # Yen has no decimals; round to nearest 100
        return round(converted_price / 100) * 100 - 1  # e.g., 6499

    whole = int(converted_price)
    return whole + 0.99 if converted_price - whole > 0.5 else whole - 0.01

Always Show the Base Currency Option

Give customers the ability to see the original price. A small note like "Approximately EUR 44.99 (USD $49.99)" builds trust and sets expectations for what will appear on their bank statement.

Checkout Conversion: Locking the Rate

This is where many stores make a critical mistake. The rate displayed on the product page should match the rate charged at checkout, even if the market has moved.

Best practice: Lock the rate when the customer adds to cart or begins checkout.

def lock_checkout_rate(cart, target_currency):
    """Lock the exchange rate for the duration of checkout."""
    rates = get_exchange_rates('USD')
    cart.locked_rate = rates[target_currency]
    cart.locked_currency = target_currency
    cart.rate_locked_at = datetime.utcnow()
    cart.save()
    return cart

Set a reasonable expiry on locked rates (15-30 minutes for most stores). If the checkout session expires, fetch fresh rates and notify the customer if the price has changed.

Rounding Rules That Protect Your Margin

Currency conversion inevitably produces fractional amounts. How you round them matters for your bottom line across thousands of transactions.

Rounding StrategyEffect on MarginBest For
Always round upProtects margin, may feel unfairB2B, high-value items
Always round downCosts margin, feels generousCustomer-first brands
Banker's rounding (round half to even)Neutral over timeHigh-volume stores
Round to nearest .99Marketing-friendlyConsumer retail

For most e-commerce stores, banker's rounding (Python's default round() behavior) is the right choice. It does not systematically bias in either direction over large numbers of transactions.

Handling Edge Cases

Zero-Decimal Currencies

Some currencies like JPY, KRW, and VND do not use decimal places. Your exchange rates API integration must handle this:

const zeroDecimalCurrencies = ['JPY', 'KRW', 'VND', 'CLP', 'ISK'];

function getDecimalPlaces(currency) {
  return zeroDecimalCurrencies.includes(currency) ? 0 : 2;
}

Currency Restrictions

Some countries restrict which currencies can be used in transactions. While this is more of a payments processing concern, your currency selector should only show currencies that your payment gateway can actually process.

Tax Implications

In the EU, prices shown to consumers must include VAT, and the VAT amount may need to be calculated in the local currency before conversion. Consult with a tax advisor for your specific markets.

Monitoring and Reconciliation

Once your multi-currency pricing is live, you need to track how it performs.

Key metrics to monitor:

AllRatesToday's exchange rates API returns mid-market rates with 60-second updates. Your payment processor settles at its own rate, so build a small buffer into your prices. The free tier (no card) is enough to test the integration; a live store is commercial use, so plan on a paid tier from €4.99/month (5,000 requests/month) when you launch.

Getting Started Today

Adding multi-currency pricing to your store does not have to be a month-long project. Here is a practical timeline:

Day 1: Sign up for AllRatesToday, get your API key, and test the endpoints.

Day 2-3: Implement server-side rate caching and a currency selector on your storefront.

Day 4-5: Add price conversion logic, checkout rate locking, and display formatting.

Day 6-7: Test with real orders in a staging environment, verify rounding and reconciliation.

Start with your top 5-10 target currencies rather than trying to support all 160+ from day one. You can always expand later.

Ready to add multi-currency pricing to your store? Get your free API key and start building today. With a free tier to test, paid plans from €4.99/month, 60-second updates, and data sourced from institutional foreign exchange market data and central banks, AllRatesToday gives you the reliable exchange rates API your store needs to sell globally.


Explore the full API documentation for endpoint details, or check out pricing plans for high-volume stores.

Frequently Asked Questions

How do I add multi-currency pricing to my e-commerce store?

Integrate an exchange rates API to fetch live rates, cache them server-side, and convert your base prices into the customer's local currency. The three common patterns are client-side conversion (simple stores), server-side caching (most stores), and pre-computed price tables (high-traffic stores).

How often should I update exchange rates for my online store?

It depends on your store type. Digital products can update every 1-6 hours, physical goods every 1-4 hours, high-value items every 15-60 minutes, and travel or financial services in real-time (60 seconds). AllRatesToday updates every 60 seconds to cover all use cases.

Should I lock the exchange rate at checkout?

Yes. Best practice is to lock the exchange rate when the customer adds to cart or begins checkout, with a 15-30 minute expiry. This ensures the displayed price matches the charged price and prevents customer surprise from rate movements during the checkout flow.

How do I handle currency rounding in e-commerce?

Use banker's rounding (round half to even) for most stores as it does not systematically bias in either direction. For consumer retail, consider rounding to the nearest .99 for psychological pricing. Also handle zero-decimal currencies like JPY and KRW separately.

Can I use a free exchange rates API for my online store?

Yes, for testing. AllRatesToday's free tier (no card) gives you 60-second updates and 160+ currencies, enough to validate your integration. A live store is commercial use, so plan on a paid tier from €4.99/month (5,000 requests/month) at launch.

Try AllRatesToday free

npm install @allratestoday/sdk

Sell Globally with Accurate Rates

Real-time mid-market rates, 160+ currencies, 60-second updates. Add multi-currency pricing to your store in days, not months.

Get Your Free API Key

Related Articles