Fetching Buy Price

The Fetching Buy Quote API enables merchants to retrieve the buy price for specific crypto assets in real time. This is essential for providing accurate quotes to users during the onramp process.

Merchants can use this API to get the buy price for the required crypto assets in exchange for supported fiat currencies on the required blockchain network.

Functionality Overview

The API calculates the price based on:

  1. The fiat currency (from_currency).
  2. The crypto token to be purchased (to_currency).
  3. The blockchain network (network).
  4. Either the fiat amount to be converted (from_amount) or the crypto amount required (to_amount).

This flexibility ensures real-time, accurate pricing tailored to merchant and user needs.

Sample Request

Here’s an example API request:

curl --location 'https://mudrex.com/api/v2/wallet/w/quote?from_currency=INR&to_currency=USDT&network=BSC&to_amount=55.38' \
--header 'X-Timestamp: {{timestamp}}' \
--header 'X-Client-Id: •••••••' \
--header 'X-Request-Id: 3456' \
--header 'X-User-Id: •••••••' \
--header 'X-Secret-Key: •••••••'
{
  "success": true,
  "data": {
    "from_currency": "INR",
    "to_currency": "USDT",
    "from_amount": 5036.81,
    "pre_fee_to_amount": 55.49,
    "to_amount": 55.38,
    "base_price": 90.77,
    "final_price": 90.95,
    "total_fee": 0.11,
    "fee_currency": "USDT",
    "fee_breakup": {
      "platform_fee": 0.111,
      "network_fee": 0,
      "client_fee": 0,
      "discount": 0,
      "tax_on_fee": 0,
      "tds": 0
    }
  }
}

Required Parameters

ParameterDescriptionSupported ValuesRequired
from_currencyThe fiat currency to be convertedINR (Indian Rupee)
EUR (Euro)
GBP (Pound)
Yes
to_currencyThe crypto asset to be purchasedUSDT, USDCYes
networkThe blockchain network for the transactionAll major networks (Matic preferred for cost-efficiency)Yes
from_amountAmount of fiat currency to be convertedRequired numeric valueEither this or to_amount is required
to_amountAmount of crypto asset to be purchasedRequired numeric valueEither this or from_amount is required

Additional Notes

  • Preferred Network: While all major networks are supported, Matic is recommended due to lower costs.
  • Mandatory Parameters: Ensure all required parameters are included to avoid errors.

For more details on the quote, refer to the Fetch Buy Quote API Reference here.