kamiPay LogokamiPay Docs

Oracle

Get real-time currency rates for your payments.

This is the endpoint provides the exchange rates between supported currencies. Supported currency pairs indicate what the input and output numbers mean, example USDTBRL means that the input amount is in USDT and the output will be the converted BRL amount at the current rate. Oracle Rates for USDBRL are fixed for a specific amount of time provided in the timeout key in the response.

Path Parameters

NameTypeDescription
pairstringRequired. BRLUSDT / USDTBRL / ARSBRL / BRLARS / USDTARS. The first pair is the one we put the amount for, and the second is the amount expected as output
typestringRequired. When you are receiving a payment is 'charge', if you are paying is 'pay'
amountfloatRequired. Floating number
exchangestringOptional. If you are using ARSBRL pair, you can add what specific rate from a local exchange you want to use. Default value will be taken from Yadio Average but if you want to select a specific local exchange you can add the key exchange=xxxx and you can type fiwind, lemoncash, belo, etc.
chainstringOptional. Default value is polygon, but if you are operating with Tron you can also select Tron. While rates are the same it's safer to use the right chain in case there are are policy changes in future.

Example Request

const pair = "BRLUSDT"
const type = "charge"
const amount = 100
 
const url = `${baseURL}/v2/oracle?pair=${pair}&type=${type}&amount=${amount}`
 
const response = await fetch(url, {
    method: "GET",
    headers: {
      Authorization: `Bearer ${access_token}`,
      "Content-Type": "application/json",
    },
});

Response

{
  "status_code": 200,
  "msg": "Request ok",
  "data": {
    "total_brl": 100.0,
    "total_usdt": 19.37735,
    "rate": 0.193773,
    "timeout": 178
  }
}

Response Details

The response includes:

  • total_brl/total_usdt: The total amount you quoted and the expected amount after conversion. For instance, if I use 100 BRLUSDT, then I'll get total_brl: 100, and total_usdt: 19.37 meaning that this will be the amount I would get after receiving the payment.

  • If instead of type=charge you use type=pay, and you put BRLUSDT, it means that you will be setting the exact amount to be paid and it'll output the amount of USDt you need to send. If you put USDTBRL, you are defining how much USDt you want to send and it'll output how much BRL will be paid.

Timeout only available for BRL-USDT Pairs, it indicates the time in seconds left until the rate is updated.

On this page