Currency Exchange Endpoint

The Currency Exchange endpoint allows you to get the exchange of any local currency compared against USD

Currency Exchange

GET api-stg.onekeypayments.com/v3/exchange_rates?country={country}&amount={amount}

The exchange_rates endpoint allow you to get the exchange of any currency compared against USD.

Query Parameters

NameTypeDescription

country

string

Country ISO code in whose local currency the amount will be converted to.

amount

number

Amount to convert in USD. If none is specified, 1 will be assumed.

Headers

NameTypeDescription

Authorization

string

"Bearer " + Read-Only API Key

{
  "fx_rate":5.8829,
  "currency":"BRL",
  "converted_amount":58.829
}

Please find all the country codes in the Countries Specifications section.

Description

The currency exchange endpoint allows you to check the exchange of any currency against USD.

Request

In order to start using the Currency Exchange endpoint, you need to:

  1. Send the request with GET method.

  2. Specify a valid country code in the request as QUERY PARAMS.

  3. Optionally, you can send the amount in USD you want to convert. Otherwise we will return the exchange for USD 1.

  4. Send the Authorization header with your read-only API Key as Bearer as follows:

Authorization: Bearer your_read_only_key_here

Example request

curl --location --request GET 'https://api-stg.onekeypayments.com/v3/exchange_rates?country=BR&amount=10' \
--header 'Authorization: Bearer your_read_only_key_here'

Example Response

{
  "fx_rate":5.8829,
  "currency": "BRL",
  "converted_amount":58.829
}

Response fields

Field name

Format

Description

fx_rate

Number

Currency exchange

currency

String

Currency used for the conversion

converted_amount

Number

Amount resulting from multiplying the amount you sent with the fx_rate

Last updated