Quotes API - offramp

To quickly return an accurate price estimate for the requested amount for the coin/token

Note: Quotes endpoint currently supports INR currency pair, support for other currencies would be added soon.

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

quantity*

Float

refers to the crypto quantity to be sold

fiatType*

Integer

fiat type used for the transaction

1 -> INR (Indian rupee)

type*

Integer

refers to the type of transaction 2 -> offramp

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

{
   "status":1,
   "code":200,
   "data":{
      "fiatAmount":173.52,
      "rate":89.28,
      "onrampFee":0.89,
      "clientFee":0,
      "gatewayFee":2.36,
      "tdsFee":1.79
   }
}

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)
      fiatType: 1,     // Fiat Type from config file(1 for INR || 2 for TRY)
      type: 2,          // 2 -> offramp  
      quantity: 2      // refers to the crypto quantity to be sold  
    }
    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,
   "code":200,
   "data":{
      "fiatAmount":173.52,
      "rate":89.28,
      "onrampFee":0.89,
      "clientFee":0,
      "gatewayFee":2.36,
      "tdsFee":1.79
   }
}

Last updated