Unparalleled suite of productivity-boosting Web APIs & cloud-based micro-service applications for developers and companies of any size.

APICurrency

Create A Currency Converter Application Quickly With Exchange Rates API

There are hundreds of officially recognized currencies around the world. Almost every country has its own official currency. Countries use their official currencies in all kinds of trade and shopping, and these currencies have a value against the currencies of other countries.

The value of the currencies of the countries to the currencies of other countries decreases or increases for many economic and political reasons. There are many ways to find out the value of currency values ​​to currencies in other countries. The easiest and online way to do this is through currency converter applications using a currency API.

Currency converter applications provide the opportunity to convert between hundreds of currencies by integrating services that provide currency conversion API services into their applications.

In this article, we will simulate a currency converter application by quickly integrating Exchangerates API, one of the most popular services that provides currency conversion API, into the Nodejs project.

How can I build a currency converter with Nodejs?

Exchangerates API, which provides Currency conversion API service, provides exchange rate information and conversion values ​​of more than 200 officially recognized currencies in the world in just milliseconds. In addition, providing historical data as a service has made it the most popular currency conversion API service today.

Before integrating and using the Exchangerates API in your project, it is necessary to have an API key. This API key can be obtained by registering one of the packages on the official website of Exchangerates API.

After obtaining the API key, we create a Nodejs project and paste the following piece of code.

var axios = require(‘axios’);

//Assume that this value comes from user
var from = ‘USD’;
var to = ‘EUR’;
var amount = 25

var config = {
    method: ‘get’,
    url: ‘https://api.exchangeratesapi.io/v1/convert?access_key=c0*****f&from=’ + from + ‘&to=’ + to + ‘&amount=’ + amount,
    headers: {}
};
axios(config)
    .then(function(response) {
        console.log(JSON.stringify(response.result));
    })
    .catch(function(error) {
        console.log(error);
    });

Let’s assume that there are ‘from’, ‘to’ and ‘amount’ values ​​in the application and the user makes a currency conversion by entering these values ​​as in the example picture below.

When this code runs, the following value will be printed on the console of the application.

23.150957

For another example, we can paste the code below into the application.

var axios = require(‘axios’);

//Assume that this value comes from user
var from = ‘GBP’;
var to = ‘EUR’;
var amount = 75

var config = {
    method: ‘get’,
    url: ‘https://api.exchangeratesapi.io/v1/convert?access_key=c0*****f&from=’ + from + ‘&to=’ + to + ‘&amount=’ + amount,
    headers: {}
};
axios(config)
    .then(function(response) {
        console.log(JSON.stringify(response.result));
    })
    .catch(function(error) {
        console.log(error);
    });

When this code runs, the following value will be printed on the console of the application.

89.171605

Ready to get started using a currency converter API?

The demand for Currency converter applications is increasing day by day. In this increasing demand environment, there are many ways for companies with applications to get ahead of their competitors. The most popular of these ways is that it supports almost all official currencies in the world. With Exchangerates API, you can increase the transaction volume of your business while providing your users with more than 200 currencies through your application. In addition, Exchangerates API aims to provide a great user experience to your customers in your application by making all these currency conversion values ​​in just milliseconds.

Sign up for Exchangerates API today!

Related posts
API

API monetization models for software developers - A guide to monetizing APIs

API

Zenserp vs. Yandex Reverse Image Search: What's The Best?

API

7 Best Free Currency Converter APIs In 2022

API

What Is Geolocation Data, Where To Get It, And Examples

Leave a Reply

Your email address will not be published. Required fields are marked *