报价与下单
下单分两步:先报价拿 quoteToken,再用令牌下单。这个设计保证扣款金额由服务端决定,客户端无法篡改价格。
第 1 步:报价
POST /api/iplt/client/residential/live/quote
认证方式:API Key(x-merchant-code + x-merchant-token)
请求头
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| x-merchant-token | 是 | String | 商户令牌(API Key 的 token 部分) |
| x-merchant-code | 是 | String | 商户代码(API Key 的 code 部分) |
| Content-Type | 否 | String | 固定 application/json(POST/PUT 必填) |
请求参数(Body)
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| productId | 是 | String | 商品 ID,来自商品目录 |
| quantity | 是 | Integer | 购买 IP 数量 |
| kind | 否 | String | 商品类型,一般由商品目录回填 |
| lang | 否 | String | 返回语言:zh / en |
curl -s -X POST 'https://www.iplight.net/api/iplt/client/residential/live/quote' \
-H 'Content-Type: application/json' \
-H 'x-merchant-code: YOUR_CODE' \
-H 'x-merchant-token: YOUR_TOKEN' \
-d '{"productId": "L30M-USA-SEATTLE-N", "quantity": 1}'
{
"msg": "操作成功",
"code": 200,
"data": {
"items": [
{
"productId": "L30M-USA-SEATTLE-N",
"name": "美国 · 西雅图 原生",
"quantity": 1,
"unitPrice": 5.5,
"payable": 5.5,
"discount": 0,
"listPrice": 5.5,
"priceLabel": "标准价",
"renewOf": null
}
],
"total": 5.5,
"originalTotal": 5.5,
"payable": 5.5,
"discount": 0,
"currency": "USD",
"quoteToken": "<一次性令牌>",
"expiresAt": "<过期时间>",
"walletBalance": 128.5,
"kind": "NATIVE",
"renewOf": null
}
}
第 2 步:下单
POST /api/iplt/client/residential/live/purchase
认证方式:API Key(x-merchant-code + x-merchant-token)
请求参数(Body)
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| productId | 是 | String | 商品 ID |
| quantity | 是 | Integer | 购买 IP 数量 |
| quoteToken | 是 | String | 报价接口返回的令牌 |
| requestNo | 否 | String | 幂等键。同值重复提交返回首次结果,不会重复扣款 |
curl -s -X POST 'https://www.iplight.net/api/iplt/client/residential/live/purchase' \
-H 'Content-Type: application/json' \
-H 'x-merchant-code: YOUR_CODE' \
-H 'x-merchant-token: YOUR_TOKEN' \
-d '{
"productId": "L30M-USA-SEATTLE-N",
"quantity": 1,
"quoteToken": "<第 1 步返回的令牌>",
"requestNo": "your-order-ref-20250722-001"
}'
建议强烈建议每次都传
requestNo。网络超时、用户双击、任务重跑时,它是唯一能防止重复扣款的手段。已购资源
GET /api/iplt/client/residential/live/resources?effectiveStatus=CURRENT&page=1&pageSize=20
认证方式:API Key(x-merchant-code + x-merchant-token)
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| effectiveStatus | 否 | String | 资源状态,默认 CURRENT |
| page | 否 | Integer | 页码,默认 1 |
| pageSize | 否 | Integer | 每页条数,默认 100,上限 200 |
| lang | 否 | String | 返回语言 |
返回 { rows, total, page, pageSize, pending, pendingTotal, counts },其中 counts 是各状态的数量汇总,适合做页签计数。
自动续费
POST /api/iplt/client/residential/live/resources/{id}/auto-renew
认证方式:API Key(x-merchant-code + x-merchant-token)
请求参数(Body)
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| enabled | 是 | Boolean | 开启 / 关闭自动续费 |
| version | 否 | Integer | 资源版本号,用于乐观锁;不匹配会返回 409 |
注意开关自动续费会返回
409 表示资源状态已变化(例如刚好到期),此时应重新拉取资源列表再操作。