Quotes API - onramp

To quickly return an accurate price estimate for the requested amount for the coin/token (fiat to crypto)

Note:

  • Supported Currencies: To view the list of all the fiat currencies supported by Onramp, click here.

  • Supported Payment Methods: To view the list of all the supported payment methods for various currencies supported by Onramp, click here.

POST https://api.onramp.money/onramp/api/v2/common/transaction/quotes

Headers

NameTypeDescription

X-ONRAMP-APIKEY*

String

Your api key

X-ONRAMP-PAYLOAD*

String

payload generated for the request

X-ONRAMP-SIGNATURE*

String

signature generated for the request

Request Body

NameTypeDescription

coinId*

Integer

coinId from config file

chainId*

Integer

chainId from config file

fiatAmount*

Float

Fiat Amount

fiatType*

Integer

fiat type used for the transaction

1 -> India (Default) INR

2 -> Turkey (TRY)

3 -> Arab Emirates Dirham (AED)

4 -> Mexican Peso (MXN)

5 -> Vietnamese dong (VND)

6 -> Nigerian Naira (NGN)

etc

Note: For a complete list of supported fiat currencies, please visit the "Fiat Currencies" page under "Supported Assets & Fiat"

type*

Integer

refers to the type of transaction 1 -> onramp

coinCode

String

Name of the coin (also denoted as key in data.allCoinConfig in the response returned in the allConfig endpoint)

E.g.

usdt | usdc | busd | eth | bnb | matic | sol

Note:

either coinId or coinCode, can be passed. When passed both, coinCode takes precedence

network

String

supported networks by onramp for onchain transactions

E.g. of supported networks:

usdt - bep20 | matic20 | erc20 | trc20

usdc - bep20 | matic20

busd - bep20

eth - erc20 | matic20

Note:

either chainId or network, can be passed. When passed both, network takes precedence

Please see detailed response below

Sample Request

var CryptoJS = require('crypto-js');
var axios = require('axios');
async function getQuotes() {
  try {
    let body = {
      coinId: 54,   
      coinCode: "usdt",  // (if both coinId and coinCode are passed -> coinCode takes precedence)
      chainId: 3,    
      network: "bep20",  //(if both chainId and network are passed -> network takes precedence)
      fiatAmount: 200, 
      fiatType: 1,     // Fiat Type from config file 1 for INR || 2 for TRY || 3 for AED || 4 for MXN etc
      type: 1          // 1 -> onramp || 2 -> offramp 
    }
    let payload = {
      timestamp: new Date().getTime(),
      body
    }
    let apiKey = 'API_KEY', apiSecret = 'API_SECRET';
    payload = Buffer.from(JSON.stringify(payload)).toString('base64');
    let signature = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(payload, apiSecret));
    let options = {
      url: 'https://api.onramp.money/onramp/api/v2/common/transaction/quotes',
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json;charset=UTF-8',
        'X-ONRAMP-SIGNATURE': signature,
        'X-ONRAMP-APIKEY': apiKey,
        'X-ONRAMP-PAYLOAD': payload
      },
      data: body
    };
    let data = await axios(options)
    console.log(data?.data);
  } catch (error) {
    console.log(error?.response?.data)
  }
}
getQuotes();
{
   "status":1,
   "data":{
      "rate":24.41,
      "quantity":7.88,
      "onrampFee":0.5,
      "clientFee":0,
      "gatewayFee":0,
      "gasFee":7.08
   },
   "code":200
}

Last updated