curl -X POST https://{BASE_URI}/api/tron/recharge/create_recharge
{
"using_user": "user_123",
"token_id": 1,
"force": false
}
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| using_user | string | 是 | 商户侧的用户唯一标识 (User ID) |
| token_id | number | 是 | 币种 ID (如: 1=TRX, 具体参考获取的币种信息) |
| force | boolean | 否 | true 则立即结束用户当前未完成的收款订单,并为用户生成一个全新的TRON地址。注意:每次调用该接口都会生成全新的收款地址 (默认: false) |
{
"code": 1000,
"message": "success",
"data": {
"no": "AU_251129211439...",
"using_user": "user_123",
"address": "TQCgLnDCtb3...",
"token_id": 1,
"start": 1698380000,
"end": 1698381800,
"valid_time": 180
}
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| no | string | 订单号 |
| using_user | string | 商户侧用户标识 |
| address | string | TRON地址 (用户需向此地址转账) |
| token_id | number | 币种ID |
| start | number | 地址生效时间 (时间戳) |
| end | number | 地址失效时间 (时间戳) |
| valid_time | number | 有效时长 (分钟) |
<?php
// 示例:创建 TRON 订单(PHP 原生 cURL)
$baseUrl = 'https://{BASE_URI}';
$url = $baseUrl . '/api/tron/recharge/create_recharge';
// 请求体数据(根据接口要求填写)
$data = [
'using_user' => 'u_888', // 使用用户-商户侧用户唯一标识
'token_id' => 1 // Token ID
];
// 初始化 cURL
$ch = curl_init($url);
// 设置 POST 与请求体(JSON)
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
// 设置请求头
$headers = [
'Content-Type: application/json',
'uu-api-key: your_api_key', // 替换为你的 API Key
'User-Agent: sclink-client/1.0'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// 超时与返回体
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // 整体超时(秒)
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // 连接超时(秒)
// 执行请求
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// 错误处理
if ($response === false) {
$err = curl_error($ch);
curl_close($ch);
die('请求失败:' . $err);
}
curl_close($ch);
// 输出与解析
echo "HTTP 状态码: {$httpCode}\n";
echo "响应原文: {$response}\n";
// 如为 JSON,可解析为数组
$respData = json_decode($response, true);
if (json_last_error() === JSON_ERROR_NONE) {
print_r($respData);
} else {
echo "响应不是合法的 JSON。\n";
}
const axios = require("axios");
const data = {
using_user: "u_888", // 使用用户-商户侧用户唯一标识
token_id: 1, // Token ID
};
axios.post(
"https://{BASE_URI}/api/tron/recharge/create_recharge", // 请求地址 URI
data,
{
headers: {
"Content-Type": "application/json",
"uu-api-key": "your_api_key",
},
},
);