> ## Documentation Index
> Fetch the complete documentation index at: https://gasdocs-zh.gasstation.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 购买资源创建订单

> 购买资源创建订单

#### 请求参数数据结构

**request\_id** `string` *required*

业务方ID.不可重复提交,限 32 字符,仅支持字母、数字、下划线（`_`）和短横线（`-`）.

**receive\_address** `string` *required*

资源接收地址

**buy\_type** `integer`

购买资源方式 0:客户指定数量(默认),1:系统预估

> [!NOTE]
>
> **所有方式均遵守最小购买值限制：**
>
> * 带宽的最小购买数量为 5000
>
> * 能量的最小购买数量为 64400
>
> 1. **系统预估（buy\_type = 1）**
>    * 请确保 receive\_address 持有contract\_address对应代币,否则矿工费预估失败。
>    * 只能购买能量,不支持购买带宽
> 2. **客户指定数量（buy\_type = 0）时，不能同时购买能量和带宽**
>    * `energy_num` 与 `net_num` 只能二选一
> 3. **buy\_type = 0 时参数要求**
>    * 至少填写 `energy_num` 或 `net_num` 其中一个

**service\_charge\_type** `string` *required*

租赁周期code :请求order/price接口返回分钟 小时 天 不同时间的费用code。
示例：10分钟:10010, 1小时:20001, 1天:30001

> [!NOTE]
>
> 能量速充类型 `10000` 不支持通过本接口下单，请使用 `/api/tron/gas/flash/open`。

**energy\_num** `integer`

购买能量数量 :最小值64000

> [!NOTE]
>
> 选择buy\_type=0时需要填写。

**net\_num** `integer`

购买带宽数量 :最小值5000

> [!NOTE]
>
> 选择buy\_type=0时需要填写。

**address\_to** `string`

转账到账地址，用于预估矿工费。

> [!NOTE]
>
> 选择buy\_type=1时需要填写。

**contract\_address** `string`

合约地址，用于预估矿工费。

> [!NOTE]
>
> 选择buy\_type=1时需要填写。

#### 响应参数数据结构

**object**

**trade\_no** `string`

订单ID

**amount** `string`

支付金额

```curl cURL theme={null}
  curl -X POST \
'https://openapi.gasstation.ai/api/tron/gas/create_order?app_id=49e9c57da66788e5178c8fec2905067b&data=+7d8kre2+XHyvSY9ueXT8DuoFsgeij0K7zdCS3rJkq7icyRh+frctiUaOROBU6kAoN4OJ+MPX174QAMLOSZ8f2UluhXcLA8HQdUfc0azP6O65XcfZrufshkHmeleQwz0xlbY4/GuegUaZqeDMu4Yja6a4eqL526f/RpZc12czAaiiozHgLs94qG7mQcgMVaW'
```

```json theme={null}
{
"code": 0,
"msg": "Success",
"data": {
    "amount": "2.187",
    "trade_no": "GAS48760509"
}
}

```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.