Convert Prices Using Ticker
Converts a value to or from the currency defined by the URL ticker. Use from to buy an equivalent amount of the ticker currency, or to to calculate its value in another currency. No funds are exchanged.
GET
https://api.kingpay.online/{ticker}/convert/ Use a supported coin or token ticker, such as btc, ltc, trc20/usdt or erc20/usdt.
Parameters
value— positive amount in thefromcurrency whenfromis supplied; otherwise, amount in the URL ticker currency.from— source currency code (fiat or crypto). Converts into the URL ticker.to— target currency code (fiat or crypto). Converts from the URL ticker whenfromis absent.
Supply at least one of from or to. If both are supplied, from takes precedence and to is ignored for compatibility with existing integrations.
Response
{
"status": "success",
"exchange_rate": "1",
"value_coin": "100"
}exchange_rate— amount of the external currency (from, ortowhenfromis absent) per 1 unit of the ticker currency.value_coin— resulting amount: in the ticker currency forfromrequests (value / exchange_rate), or intofor outgoing conversions (value * exchange_rate).
Examples
# Convert 100 USD to TRC20 USDT
GET /trc20/usdt/convert/?value=100&from=USD
# Convert 100 EUR to ERC20 USDT
GET /erc20/usdt/convert/?value=100&from=EUR
# Convert 100 USD to BTC
GET /btc/convert/?value=100&from=USD
# Convert 100 BTC to USD
GET /btc/convert/?value=100&to=USD
# Convert 100 TRC20 USDT to EUR
GET /trc20/usdt/convert/?value=100&to=EUR