Exchange Rate API
You can use the exchange rate API to get the latest rate for any currency pair. It can be used on its own or before starting a currency conversion. However, fetching the exchange rate is a prerequisite to initiating a currency conversion transaction.
To get the latest exchange rate for a currency pair, make a POST request to the exchange rate endpoint;
{{baseurl}}/api/v1/conversions/rates
The request body should have the following parameters:
Field | Data Type | Description |
---|---|---|
from_currency | String | The currency from which the user is converting. For example, if you wanted to convert Nigerian Naira to US Dollar, the from_currency will be NGN. |
to_currency | String | The currency to which the user wants to convert funds. For example, if you wanted to convert Nigerian Naira to US Dollar, the to_currency will be USD. |
amount | Number | The amount to be converted (referring to the from_currency ). |
reference | String | A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile the conversion. |
Here's an example of a response to the request.
{
"status": true,
"message": "Conversion rate retrieved successfully",
"data": {
"from_currency": "USD",
"to_currency": "NGN",
"from_amount": 10,
"to_amount": 14400,
"rate": 1440,
"reference": "1ccdb7da-e732-4610-a17f-5abfb7617d99",
"expiry_in_seconds": 25
}
}
Updated 23 days ago