API 路径、字段名、事件名和代码示例保持英文,与接口完全一致,可直接复制使用。
创建代付
POST/v1/payouts
从您的余额向玩家的钱包发送 USDT 或 USDC,即代付(出款)。请使用唯一的 request_id,这样重试永远是安全的。
请求体
| 字段 | 类型 | 说明 |
|---|---|---|
request_id | string · 必填 | 您给这笔代付的唯一 ID(幂等键:同一个 ID 重复调用结果相同)。1–128 个字符,可用 A–Z a–z 0–9 _ . : -。 |
chain | string · 必填 | 链 ID,例如 tron 或 bsc。 |
token | string · 必填 | USDT 或 USDC,以您账户已开通的为准。 |
to | string · 必填 | 收款钱包地址。EVM 地址如果大小写混合,必须是有效的校验和格式。 |
amount | string · 必填 | 以代币最小单位表示的整数,大于 0。 |
player_ref | string · 选填 | 您给玩家的标识,会在响应和 Webhook 中原样返回。 |
player_name | string · 选填 | 玩家的用户名,在后台中显示在 player_ref 旁边(需要同时传 player_ref)。见创建地址。 |
示例
const { status, body } = await icn("POST", "/v1/payouts", { request_id: "wd-1001", chain: "tron", token: "USDT", to: "TXyZ4k...9kP", amount: "50000000", // 50 USDT (6 decimals) player_ref: "player_1024", });
status, body = icn("POST", "/v1/payouts", { "request_id": "wd-1001", "chain": "tron", "token": "USDT", "to": "TXyZ4k...9kP", "amount": "50000000", # 50 USDT (6 decimals) "player_ref": "player_1024", })
201 Created
{
"id": "0b8e6d2a-5f3c-4b7e-8d1a-2c9f4e6a7b30",
"request_id": "wd-1001",
"status": "queued",
"asset": "tron:USDT",
"chain": "tron",
"to": "TXyZ4k...9kP",
"amount": "50000000",
"fee": "2000000",
"fee_mode": "on_top",
"send_amount": "50000000",
"total": "52000000",
"player_ref": "player_1024",
"tx_hash": null,
"reason": null,
"created_at": "2026-10-10T08:05:00.000Z",
"completed_at": null
}手续费
fee_mode 按账户设置。使用 on_top(默认)时,玩家收到完整的 amount,您的余额扣除 total = amount + fee。使用 deducted 时,手续费从金额中扣除:玩家收到 send_amount = amount − fee,且 total = amount。
幂等
- 使用新的
request_id首次请求:201 Created。 - 相同
request_id、相同参数:200 OK,返回已存在的代付。不会重复发送。 - 相同
request_id、不同参数:409 request_id_conflict。
如果请求超时,请用相同的
request_id(和新的签名)重试。结果要么是创建了代付,要么是返回已存在的那一笔。状态
| status | 含义 |
|---|---|
pending_approval | 超过您的审批阈值;等待人工审批。 |
queued | 已受理,等待发送。金库资金不足时也处于此状态:资金一到账就会发送。 |
broadcast | 已发送到网络,等待最终确认。 |
completed | 已在链上确认。tx_hash 已有值。最终状态。 |
failed | 无法发送,例如会超出您金库的链上限额。reason 说明原因;预留的金额会释放。最终状态。 |
rejected | 在审批中被拒绝。reason 说明原因。最终状态。 |
状态变化会通过 payout.* Webhook发送。以下检查按顺序进行,不通过时返回错误,不会创建代付:是否暂停、资产是否开通、金库是否配置、最低金额、单笔限额、每日限额、余额。
查询代付
GET/v1/payouts/{id}
GET/v1/payouts?request_id={request_id}
返回上面的代付对象。可以用我们的 id 或您的 request_id 查询。未知的 ID 返回 404 not_found。
const { body } = await icn("GET", "/v1/payouts?request_id=wd-1001"); console.log(body.status, body.tx_hash);
status, body = icn("GET", "/v1/payouts?request_id=wd-1001") print(body["status"], body["tx_hash"])