Skip to main content

Overview

Vellosim eSIM packages are priced in USD. If your users pay in NGN (Nigerian Naira), use this endpoint to fetch the current exchange rate so you can display the correct Naira amount before purchase. This is a public endpoint — no authentication is required.

Quick Start

async function getExchangeRate() {
  const response = await fetch('https://api.vellosim.com/api/settings/exchange-rate', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json'
    }
  });

  const data = await response.json();
  return data.data;
}

// Usage
const rateInfo = await getExchangeRate();
console.log(`1 ${rateInfo.baseCurrency} = ${rateInfo.rate} ${rateInfo.currency}`);

// Convert a USD package price to NGN
const packagePriceUSD = 5.00;
const priceInNGN = packagePriceUSD * rateInfo.rate;
console.log(`Package price: $${packagePriceUSD} = ₦${priceInNGN.toLocaleString()}`);

Response

{
  "success": true,
  "message": "Exchange rate retrieved successfully",
  "data": {
    "rate": 1600,
    "baseCurrency": "USD",
    "currency": "NGN"
  }
}

Response Fields

FieldTypeDescription
ratenumberCurrent exchange rate (1 USD = X NGN)
baseCurrencystringBase currency — always USD
currencystringTarget currency — always NGN

Usage Tips

The exchange rate doesn’t change frequently. Cache it for 10–15 minutes to reduce API calls.
Show your users both the USD price from the package and the calculated NGN amount for transparency:
Data Plan: 5GB — $4.50 (≈ ₦7,200)
Round the converted NGN amount to 2 decimal places for clean display:
const ngnPrice = Math.round(usdPrice * rate * 100) / 100;
The actual charge at purchase time uses the server-side rate, not the rate you fetched. Small differences may occur if the rate updates between display and purchase.