How to convert amounts to website visitor currency
var toCurrency = "USD" //currency to exchange to
var productAmount = 500; //product amount
// Getting the currency symbol from the user's IP
$.get("https://ipforensics.net/api/v1/origin?apikey=APIKEY", function (response) {
//this will return the currency sysmbol e.g NG
var fromCurency = response.meta_data.currency.symbol;
//make another request to
$.get(`https://ipforensics.net/api/v1/currency/convert?apikey=YOUR-API-KEY&from=${fromCurency}&to=${toCurrency}&amount=${productAmount}`, function (response) {
//shows the exchage rate
console.log(response.meta_data.exchange_rate)
}, "jsonp");
}, "jsonp");Last updated