转账套餐
购买套餐
使用账户余额购买转账套餐
POST
/
api
/
v1
/
transfer-packages
/
buy
购买套餐
curl --request POST \
--url https://api.example.com/api/v1/transfer-packages/buy \
--header 'Content-Type: application/json' \
--data '
{
"address": "<string>",
"package_size": 123,
"single_transfer": true,
"bw_guarantee": true
}
'import requests
url = "https://api.example.com/api/v1/transfer-packages/buy"
payload = {
"address": "<string>",
"package_size": 123,
"single_transfer": True,
"bw_guarantee": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
address: '<string>',
package_size: 123,
single_transfer: true,
bw_guarantee: true
})
};
fetch('https://api.example.com/api/v1/transfer-packages/buy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/transfer-packages/buy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '<string>',
'package_size' => 123,
'single_transfer' => true,
'bw_guarantee' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/transfer-packages/buy"
payload := strings.NewReader("{\n \"address\": \"<string>\",\n \"package_size\": 123,\n \"single_transfer\": true,\n \"bw_guarantee\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/transfer-packages/buy")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"<string>\",\n \"package_size\": 123,\n \"single_transfer\": true,\n \"bw_guarantee\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/transfer-packages/buy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"<string>\",\n \"package_size\": 123,\n \"single_transfer\": true,\n \"bw_guarantee\": true\n}"
response = http.request(request)
puts response.read_body购买转账套餐
使用您的账户余额购买转账套餐。请求体
string
必填
要监控的 TRON 地址
number
套餐内的转账笔数(2 – 10,000)。除非
single_transfer 为 true,否则必填。package_size: 1 会被拒绝并返回 422——购买单笔转账请发送 single_transfer: true。boolean
默认值:"false"
购买单笔转账而非套餐;此时忽略
package_size。价格为获取套餐档位中的 single_transfer_price(启用带宽保障时另加 bw_fee_per_transfer)。boolean
默认值:"true"
启用带宽保障
响应
返回package_id、status、total_price_trx、activation_cost_trx(地址尚未激活时用于激活的 TRX,否则为 0)和 total_charged_trx。
示例
curl -X POST https://api.tronrental.com/v1/transfer-packages/buy \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"address": "TYourAddress...",
"package_size": 500,
"bw_guarantee": true
}'
Response
{
"package_id": 101,
"status": "active",
"total_price_trx": "1500.0",
"activation_cost_trx": "0",
"total_charged_trx": "1500.0"
}
您也可以通过
POST /api/v1/transfer-packages/buy-invoice 使用账单付款 —
这将生成一个用于 TRX/USDT 付款的地址。⌘I
购买套餐
curl --request POST \
--url https://api.example.com/api/v1/transfer-packages/buy \
--header 'Content-Type: application/json' \
--data '
{
"address": "<string>",
"package_size": 123,
"single_transfer": true,
"bw_guarantee": true
}
'import requests
url = "https://api.example.com/api/v1/transfer-packages/buy"
payload = {
"address": "<string>",
"package_size": 123,
"single_transfer": True,
"bw_guarantee": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
address: '<string>',
package_size: 123,
single_transfer: true,
bw_guarantee: true
})
};
fetch('https://api.example.com/api/v1/transfer-packages/buy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/transfer-packages/buy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '<string>',
'package_size' => 123,
'single_transfer' => true,
'bw_guarantee' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/transfer-packages/buy"
payload := strings.NewReader("{\n \"address\": \"<string>\",\n \"package_size\": 123,\n \"single_transfer\": true,\n \"bw_guarantee\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/transfer-packages/buy")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"<string>\",\n \"package_size\": 123,\n \"single_transfer\": true,\n \"bw_guarantee\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/transfer-packages/buy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"<string>\",\n \"package_size\": 123,\n \"single_transfer\": true,\n \"bw_guarantee\": true\n}"
response = http.request(request)
puts response.read_body