api

实用工具 API

用于查询余额、汇率和支持的加密货币的实用端点。

更新于: 2026/3/9

用于查询余额、汇率和支持的加密货币的实用端点。


get-credit-balance

查询您的 Credits 余额。Credits 用于 QuantaPay 的费用扣除系统。

请求

curl -X POST https://cloud.quantapay.app/api.php \
  -d "function=get-credit-balance" \
  -d "api-key=YOUR_API_KEY"

响应

{
  "success": true,
  "response": {
    "credit_balance": 150.00,
    "credit_currency": "USD"
  }
}
字段类型描述
credit_balancenumber您当前的 Credits 余额。
credit_currencystringCredits 余额的货币单位(通常为 USD)。

get-balances

查询您所有已配置钱包地址的加密货币余额。

请求

curl -X POST https://cloud.quantapay.app/api.php \
  -d "function=get-balances" \
  -d "api-key=YOUR_API_KEY"

响应

返回所有已配置加密货币地址的余额数据。

{
  "success": true,
  "response": {
    "btc": {
      "amount": "0.5432",
      "fiat": "35210.50"
    },
    "eth": {
      "amount": "12.345",
      "fiat": "45678.90"
    }
  }
}

get-exchange-rates

获取法定货币与加密货币之间的当前汇率。

请求

curl -X POST https://cloud.quantapay.app/api.php \
  -d "function=get-exchange-rates" \
  -d "api-key=YOUR_API_KEY" \
  -d "currency_code=USD" \
  -d "cryptocurrency_code=btc"

参数

参数类型必需描述
currency_codestring法定货币代码(例如 USDEUR)。
cryptocurrency_codestring加密货币代码(例如 btceth)。

响应

{
  "success": true,
  "response": "64850.25"
}

响应值为 1 个单位加密货币以指定法定货币计价的价格。


get-fiat-value

将加密货币金额转换为等值的法定货币金额。

请求

curl -X POST https://cloud.quantapay.app/api.php \
  -d "function=get-fiat-value" \
  -d "api-key=YOUR_API_KEY" \
  -d "amount=0.5" \
  -d "cryptocurrency_code=btc" \
  -d "currency_code=USD"

参数

参数类型必需描述
amountnumber要转换的加密货币数量。
cryptocurrency_codestring加密货币代码(例如 btceth)。
currency_codestring目标法定货币代码(例如 USD)。

响应

{
  "success": true,
  "response": "32425.13"
}

get-cryptocurrency-codes

获取所有支持的加密货币代码及其网络分组列表。

注意:此功能已在 API 路由器(api.php)中注册,但后端(ajax.php)中没有处理程序。调用将通过参数验证但返回空响应。需要实现处理程序后此端点才能工作。

请求

curl -X POST https://cloud.quantapay.app/api.php \
  -d "function=get-cryptocurrency-codes" \
  -d "api-key=YOUR_API_KEY" \
  -d "cryptocurrency_code="

参数

参数类型必需描述
cryptocurrency_codestring传入空字符串获取所有代码,或传入区块链名称(例如 eth)仅获取该网络的代码。

预期响应

{
  "success": true,
  "response": {
    "BTC": ["btc"],
    "ETH": ["eth", "usdt", "usdc", "link", "shib", "bat"],
    "SOL": ["sol"],
    "TRX": ["usdt_tron"],
    "BSC": ["bnb", "busd", "usdt_bsc"],
    "XRP": ["xrp"],
    "LTC": ["ltc"],
    "DOGE": ["doge"],
    "BCH": ["bch"],
    "ALGO": ["algo"],
    "XMR": ["xmr"]
  }
}

响应将区块链网络映射到其支持的加密货币代码。通过 Settings → Payments → Custom Token 添加的自定义代币也会包含在内。