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

Request Body

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