OxaPay Docs
Legacy
Legacy
  • Introduction
  • Getting Started
  • Integrations
    • Payment Links
    • Donations
    • Merchant API
    • Payout API
    • Plugins
      • WooCommerce
      • WISECP
      • Clientexec
      • Blesta
      • WHMCS
      • PrestaShop
      • Easy Digital Downloads
      • Paid Memberships Pro
      • Gravity Forms
      • Restrict Content Pro
    • Merchant and Payout Service with API
  • API Reference
    • Creating an Invoice
    • Creating White-Label Payment
    • Creating Static Wallet
    • Revoking Static Wallet
    • Static Wallets List
    • Payment Information
    • Payment History
    • Accepted Coins
    • Price
    • Creating Payout
    • Payout Information
    • Payout History
    • Account Balance
    • Exchange Rate
    • Exchange Calculate
    • Exchange Pairs
    • Exchange Request
    • Exchange History
    • Supported Currencies
    • Supported Fiat Currencies
    • Supported Networks
    • System Status
    • Result code table
    • Merchant status table
    • Payout status table
  • Webhook
  • Use Cases
  • Troubleshooting
Powered by GitBook
On this page
  • Example codes
  • Usage
  1. API Reference

Exchange Rate

The endpoint allows users to obtain real-time exchange rates for cryptocurrency pairs supported by OxaPay. This feature is particularly useful for applications that require up-to-date cryptocurrency prices.

POST https://api.oxapay.com/exchange/rate

Request Body

Name
Type
Description

fromCurrency*

string

toCurrency*

string

{
  "result": integer, // The result code indicates the success or failure of the request.
  "message": string, // A message providing additional information about the result.
  "rate": string // The real-time exchange rate representing the number of units of `fromCurrency` equivalent to `toCurrency`.
}

Example codes

curl -X POST https://api.oxapay.com/exchange/rate \
     -d '{
          "fromCurrency": "USDT",
          "toCurrency": "TRX"
      }'
<?php

$url = "https://api.oxapay.com/exchange/rate";

$data = array(
    "fromCurrency" => "USDT",
    "toCurrency" => "TRX"
);

$options = array(
    'http' => array(
        'header' => 'Content-Type: application/json',
        'method'  => 'POST',
        'content' => json_encode($data),
    ),
);

$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response);
var_dump($result);
?>
const axios = require('axios');
const url = 'https://api.oxapay.com/exchange/rate';
const data = JSON.stringify({
  fromCurrency: 'USDT',
  toCurrency: 'TRX'
});

axios.post(url, data)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
import requests
import json

url = 'https://api.oxapay.com/exchange/rate'
data = {
    'fromCurrency': 'USDT',
    'toCurrency': 'TRX'
}
response = requests.post(url, data=json.dumps(data))
result = response.json()
print(result)

Usage

By providing the `fromCurrency` and `toCurrency` parameters, you can retrieve the exchange rate between the specified cryptocurrencies. For example, if you set `fromCurrency` to "BTC" and `toCurrency` to "USDT," the response will provide the real-time exchange rate for converting Bitcoin (BTC) to Tether (USDT).

Please note that the exchange rate provided in the response may fluctuate over time due to the volatile nature of cryptocurrency markets.

PreviousAccount BalanceNextExchange Calculate

Last updated 4 months ago

The code of the cryptocurrency you want to convert from

The code of the cryptocurrency you want to convert to

currency
currency