GET /apiv2/billing/account
您的后付费账户概览:Netts 设定的信用额度、您自己设定的总额度、您的欠款金额以及当前可继续消费的额度。属于后付费计费的一部分。
端点 URL
GET https://netts.io/apiv2/billing/account请求头
| 请求头 | 是否必填 | 描述 |
|---|---|---|
X-API-KEY | 是 | 拥有 billing.read 权限的 API 密钥 |
X-Netts-Billing-Format | 否 | contract-v1 用于带有币种的金额;若未发送 — 则使用下方的原始格式 |
该请求无参数。
示例
bash
curl -s 'https://netts.io/apiv2/billing/account' \
-H 'X-API-KEY: your-api-key'json
{
"success": true,
"data": {
"mode": "postpaid",
"adminLimit": {
"id": 1,
"origin": "netts",
"limit": { "unit": "USD", "value": "30000.000000" },
"used": { "unit": "USD", "value": "1250.400000" },
"available": { "unit": "USD", "value": "28749.600000" },
"creditApplied": { "unit": "USD", "value": "0" },
"status": "ok",
"revision": 3,
"editable": false
},
"clientLimit": {
"id": 4,
"origin": "client",
"limit": { "unit": "USD", "value": "5000.000000" },
"used": { "unit": "USD", "value": "1250.400000" },
"available": { "unit": "USD", "value": "3749.600000" },
"creditApplied": { "unit": "USD", "value": "0" },
"status": "ok",
"revision": 2,
"editable": true
},
"effectiveAvailable": { "unit": "USD", "value": "3749.600000" },
"pendingUnbilled": { "trx": "0", "count": 0 },
"asOf": "2026-10-19T20:24:26.474237+00:00",
"settlement": { "asset": "USDC", "network": "ethereum", "paymentTermsDays": 5 },
"limit": { "unit": "USD", "value": "30000.000000" },
"unpaid": { "TRX": "3778.500000", "USDC": "1250.400000" },
"creditUsdc": "0",
"available": "28749.600000",
"availableTrxEquiv": "86897.437285",
"availableUsdEquiv": "28749.600000",
"fx": { "usdPerTrx": "0.33084276", "at": "2026-10-19T20:24:23.449930+00:00" },
"fxStatus": "ok"
},
"timestamp": "2026-10-19T20:24:26+00:00"
}在此示例中,合约币种为 USDC;settlement.asset 显示您合约的币种。
响应字段
| 字段 | 描述 |
|---|---|
mode | postpaid,或在账户暂停后付费计费期间为 prepaid |
adminLimit | Netts 设定的信用额度。editable 始终为 false |
clientLimit | 您自己设定的总额度,若未设定则为 null |
adminLimit.used / clientLimit.used | 已占用的额度 |
adminLimit.available / clientLimit.available | 剩余的额度 |
creditApplied | 来自多付金额的信用额度,该额度已用于抵扣此额度中的欠款 |
status | ok、limit_reached,或在当前无法计算时为 unavailable |
effectiveAvailable | 您当前可消费的金额:两个 available 值中的较小者 |
pendingUnbilled | 已接受但扣费仍在记录中的订单:它们的 TRX 总计和数量 |
asOf | 计算这些数值的时间点 |
settlement | 您根据合约支付账单的方式:币种、网络和账单支付期限(天数) |
limit、unpaid、creditUsdc、available | Netts 额度、以 TRX 和合约币种计的未付金额、您的信用额度以及 Netts 额度的剩余部分 |
availableTrxEquiv、availableUsdEquiv | 按 fx 中的汇率换算的 available;没有可用汇率时为 null |
fx | TRX 对您合约币种的当前汇率以及获取汇率的时间点。此汇率仅供参考比对,并非未来订单的汇率 — 参见记录汇率 |
fxStatus | ok,或 unavailable — 此时等值金额为 null,具体金额仍会显示 |
used 和 available 的计算方式与订单检查时的计算方式相同,因此 effectiveAvailable 即为下一笔订单可使用的金额。产品额度显示在额度中。
contract-v1 响应
使用 X-Netts-Billing-Format: contract-v1 的同一账户。每个金额均为带有币种的金额,汇率则为汇率。此格式按账户启用。
bash
curl -s 'https://netts.io/apiv2/billing/account' \
-H 'X-API-KEY: your-api-key' \
-H 'X-Netts-Billing-Format: contract-v1'json
{
"success": true,
"data": {
"mode": "postpaid",
"contractCurrency": "BTC",
"paymentNetwork": "bitcoin",
"paymentTermsDays": 5,
"adminLimit": {
"id": 1,
"origin": "netts",
"limit": { "amount": "0.00020000", "currency": "BTC" },
"used": { "amount": "0.00002940", "currency": "BTC" },
"available": { "amount": "0.00017060", "currency": "BTC" },
"creditApplied": { "amount": "0", "currency": "BTC" },
"status": "ok",
"revision": 12,
"editable": false
},
"clientLimit": null,
"effectiveAvailable": { "amount": "0.00017060", "currency": "BTC" },
"pendingUnbilled": { "amount": { "amount": "0", "currency": "TRX" }, "count": 0 },
"asOf": "2026-10-23T19:26:56.790784+00:00",
"limit": { "amount": "0.00020000", "currency": "BTC" },
"unpaid": { "amount": "0.00002940", "currency": "BTC" },
"otherUnpaid": [],
"credit": { "amount": "0", "currency": "BTC" },
"otherCredits": [],
"available": { "amount": "0.00017060", "currency": "BTC" },
"trxEquivalent": { "amount": "42.048352", "currency": "TRX" },
"exchangeRate": {
"base": "TRX",
"quote": "BTC",
"rate": "0.000004057233918579",
"at": "2026-10-23T19:26:50.321789+00:00"
},
"fxStatus": "ok"
},
"timestamp": "2026-10-23T19:26:56+00:00"
}该示例使用 BTC;您的响应将显示您合约的币种。
| 字段 | 描述 |
|---|---|
mode、adminLimit、clientLimit、effectiveAvailable、asOf、fxStatus | 与原始格式相同;在额度内部,limit、used、available 和 creditApplied 均为带有币种的金额 |
contractCurrency | 您合约的币种 — 账单、付款和额度均采用该币种 |
paymentNetwork、paymentTermsDays | 您用于付款的网络和账单支付期限(天数)。在原始格式中它们位于 settlement 中 |
pendingUnbilled.amount | 已接受但扣费仍在记录中的订单的 TRX 总计。这是一个估算值,并非您的最终欠款,且已计入 used 和 available — 请勿重复相加 |
pendingUnbilled.count | 此类订单部分的数量,包括金额尚不确定的订单 |
limit | Netts 额度 |
unpaid | 您的欠款金额,以您合约的币种计 |
credit | 您来自多付金额的信用额度 |
otherUnpaid、otherCredits | 以其他币种计的欠款和信用额度 — 源自您合约早期的币种。它们单独显示且从不折算;通常为空列表。针对金额采用自身币种的合约返回 |
available | Netts 额度的剩余部分 |
trxEquivalent | 按 exchangeRate 中的汇率换算的 TRX 计 available;没有可用汇率时为 null |
exchangeRate | TRX 对您合约币种的当前汇率,仅供参考比对 — 并非未来订单的汇率 |
原始格式中的 unpaid.TRX、creditUsdc、availableUsdEquiv 和 fx 在此处没有单独的字段:金额本身带有币种,汇率为 exchangeRate。
错误响应
| HTTP | code | 含义 |
|---|---|---|
| 401 | -1, -2 | 密钥缺失或无效,或 IP 不在白名单中 — 由 API 网关返回,参见响应格式 |
| 400 | unsupported_billing_format | 未知的 X-Netts-Billing-Format 值 |
| 403 | billing_read_required | 密钥缺少 billing.read 权限 |
| 403 | postpaid_required | 该账户未开通后付费计费 |
| 403 | billing_format_not_enabled | 您的账户尚未启用 contract-v1 |
| 406 | billing_format_not_available | 请求了原始格式,但您的合约仅支持 contract-v1 |
所有代码均列在后付费计费中。