预估订单支付金额

说明

接口地址

GET /v2/order/price

请求参数

名称位置类型必选说明
resource_valuequeryintegertrue租用资源数量
rent_durationqueryintegertrue租用时长,当时间单位等于 h,暂时只支持 1 和 3,当时间单位等于 m,暂时只支持 10
rent_time_unitquerystringtrue租用时间单位,仅支持 d 天、h 小时、m 分钟
rent_time_secondqueryintegertrue租用时长(秒),必须是大于600且为3的倍数,也可请求 查询 APIKEY 详情 接口获取允许的时长,该参数不为空且有效会忽略rent_durationrent_time_unit参数,如为0则使用rent_durationrent_time_unit设置订单时长

接口返回

名称类型必选说明
codeintegertrue状态码
msgstringtrue状态说明
request_idstringtrue
dataobjecttrue
» resource_valueintegertrue租用资源数量
» pay_amountnumbertrue支付金额
» service_amountnumbertrue手续费(已包含在支付金额内)
» rent_durationintegertrue租用时长,当时间单位等于 h,暂时只支持 1 和 3,当时间单位等于 m,暂时只支持 10
» rent_time_unitstringtrue租用时间单位,仅支持 d 天、h 小时、m 分钟
» rent_time_secondintegertrue租用时长(秒)
» price_in_sunnumbertrue资源单价

返回示例

{
    "code": 0,
    "msg": "ok",
    "request_id": "d30e5f5c-21c1-4975-a982-de3169dd0959",
    "data": {
        "resource_value": 32000,
        "pay_amount": 4.4,
        "service_amount": 0.56,
        "rent_duration": 1,
        "rent_time_unit": "d",
        "rent_time_second": 86400,
        "price_in_sun": 120
    }
}

代码示例

curl --location --request GET 'https://feee.io/open/v2/order/price?resource_value=<resource_value>&rent_time_unit=<rent_time_unit>&rent_duration=<rent_duration>' \
--header 'key: <key>' \
--header 'User-Agent: Feee.io Client/1.0.0 (https://feee.io)'
package main

import (
   "fmt"
   "net/http"
   "io/ioutil"
)

func main() {

   url := "https://feee.io/open/v2/order/price?resource_value=%3Cresource_value%3E&rent_time_unit=%3Crent_time_unit%3E&rent_duration=%3Crent_duration%3E"
   method := "GET"

   client := &http.Client {
   }
   req, err := http.NewRequest(method, url, nil)

   if err != nil {
      fmt.Println(err)
      return
   }
   req.Header.Add("key", "<key>")
   req.Header.Add("User-Agent", "Feee.io Client/1.0.0 (https://feee.io)")

   res, err := client.Do(req)
   if err != nil {
      fmt.Println(err)
      return
   }
   defer res.Body.Close()

   body, err := ioutil.ReadAll(res.Body)
   if err != nil {
      fmt.Println(err)
      return
   }
   fmt.Println(string(body))
}
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
   CURLOPT_URL => 'https://feee.io/open/v2/order/price?resource_value=%3Cresource_value%3E&rent_time_unit=%3Crent_time_unit%3E&rent_duration=%3Crent_duration%3E',
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_ENCODING => '',
   CURLOPT_MAXREDIRS => 10,
   CURLOPT_TIMEOUT => 0,
   CURLOPT_FOLLOWLOCATION => true,
   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
   CURLOPT_CUSTOMREQUEST => 'GET',
   CURLOPT_HTTPHEADER => array(
      'key: <key>',
      'User-Agent: Feee.io Client/1.0.0 (https://feee.io)'
   ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

import http.client

conn = http.client.HTTPSConnection("feee.io")
payload = ''
headers = {
   'key': '<key>',
   'User-Agent': 'Feee.io Client/1.0.0 (https://feee.io)'
}
conn.request("GET", "/open/v2/order/price?resource_value=%3Cresource_value%3E&rent_time_unit=%3Crent_time_unit%3E&rent_duration=%3Crent_duration%3E", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient().newBuilder()
   .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
   .url("https://feee.io/open/v2/order/price?resource_value=<resource_value>&rent_time_unit=<rent_time_unit>&rent_duration=<rent_duration>")
   .method("GET", body)
   .addHeader("key", "<key>")
   .addHeader("User-Agent", "Feee.io Client/1.0.0 (https://feee.io)")
   .build();
Response response = client.newCall(request).execute();
上次更新: