curl --request POST \
--url https://{api}.subotiz.com/api/v1/prices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Request-Id: <request-id>' \
--data '
{
"name": "<string>",
"product_id": "<string>",
"product_version_id": "<string>",
"billing_type": "<string>",
"description": "<string>",
"price_type": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Request-Id': '<request-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
product_id: '<string>',
product_version_id: '<string>',
billing_type: '<string>',
description: '<string>',
price_type: '<string>'
})
};
fetch('https://{api}.subotiz.com/api/v1/prices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{api}.subotiz.com/api/v1/prices"
payload = {
"name": "<string>",
"product_id": "<string>",
"product_version_id": "<string>",
"billing_type": "<string>",
"description": "<string>",
"price_type": "<string>"
}
headers = {
"Request-Id": "<request-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api}.subotiz.com/api/v1/prices",
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([
'name' => '<string>',
'product_id' => '<string>',
'product_version_id' => '<string>',
'billing_type' => '<string>',
'description' => '<string>',
'price_type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Request-Id: <request-id>"
],
]);
$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}.subotiz.com/api/v1/prices"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"product_id\": \"<string>\",\n \"product_version_id\": \"<string>\",\n \"billing_type\": \"<string>\",\n \"description\": \"<string>\",\n \"price_type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Request-Id", "<request-id>")
req.Header.Add("Authorization", "Bearer <token>")
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}.subotiz.com/api/v1/prices")
.header("Request-Id", "<request-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"product_id\": \"<string>\",\n \"product_version_id\": \"<string>\",\n \"billing_type\": \"<string>\",\n \"description\": \"<string>\",\n \"price_type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api}.subotiz.com/api/v1/prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Request-Id"] = '<request-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"product_id\": \"<string>\",\n \"product_version_id\": \"<string>\",\n \"billing_type\": \"<string>\",\n \"description\": \"<string>\",\n \"price_type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"data": {
"price_id": "<string>",
"price_version_id": "<string>"
}
}创建定价方案
创建定价方案
curl --request POST \
--url https://{api}.subotiz.com/api/v1/prices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Request-Id: <request-id>' \
--data '
{
"name": "<string>",
"product_id": "<string>",
"product_version_id": "<string>",
"billing_type": "<string>",
"description": "<string>",
"price_type": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Request-Id': '<request-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
product_id: '<string>',
product_version_id: '<string>',
billing_type: '<string>',
description: '<string>',
price_type: '<string>'
})
};
fetch('https://{api}.subotiz.com/api/v1/prices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{api}.subotiz.com/api/v1/prices"
payload = {
"name": "<string>",
"product_id": "<string>",
"product_version_id": "<string>",
"billing_type": "<string>",
"description": "<string>",
"price_type": "<string>"
}
headers = {
"Request-Id": "<request-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api}.subotiz.com/api/v1/prices",
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([
'name' => '<string>',
'product_id' => '<string>',
'product_version_id' => '<string>',
'billing_type' => '<string>',
'description' => '<string>',
'price_type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Request-Id: <request-id>"
],
]);
$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}.subotiz.com/api/v1/prices"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"product_id\": \"<string>\",\n \"product_version_id\": \"<string>\",\n \"billing_type\": \"<string>\",\n \"description\": \"<string>\",\n \"price_type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Request-Id", "<request-id>")
req.Header.Add("Authorization", "Bearer <token>")
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}.subotiz.com/api/v1/prices")
.header("Request-Id", "<request-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"product_id\": \"<string>\",\n \"product_version_id\": \"<string>\",\n \"billing_type\": \"<string>\",\n \"description\": \"<string>\",\n \"price_type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api}.subotiz.com/api/v1/prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Request-Id"] = '<request-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"product_id\": \"<string>\",\n \"product_version_id\": \"<string>\",\n \"billing_type\": \"<string>\",\n \"description\": \"<string>\",\n \"price_type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"data": {
"price_id": "<string>",
"price_version_id": "<string>"
}
}授权
Bearer API Key 鉴权。格式:Authorization: Bearer {your_api_key}
请求头
请求的唯一标识符
请求体
创建定价方案请求
定价方案名称
关联商品 ID
商品版本 ID
计费类型:one_time-一次性 / recurring-周期性
定价描述
定价价格结构,取值之一:flat_price | package_price | tiers_price;based_on_usage 已废弃(存量只读),新建不可传
一次性支付价格,当 billing_type 为 one_time 时必填
是否启用试用期
试用期配置
Show child attributes
Show child attributes
定价计划,当 billing_type 为 recurring 时必填
Show child attributes
Show child attributes
资源包用量(套餐含量),当 price_type 为 package_price 时必填
用量单位,当 price_type 为 package_price 时必填
定价权益列表
Show child attributes
Show child attributes
定价模型二级类型(已废弃,逻辑并入 price_type + billing_dimension + quantity_tier_type/price_tier_type,新建不再使用)
扣费金额阈值(已废弃,新建改用 usage_threshold;存量只读回显)
试用类型:0-免费试用 | 1-付费试用
试用价格,当 trial_type 为 1(付费试用)时必填
状态:
- draft:草稿
- active:已激活
- frozen:已冻结
付费时机,取值之一:prepaid-预付费 / postpaid-后付费;默认 prepaid。 本期维度互斥:仅 (prepaid, quantity) 与 (postpaid, usage) 允许,其余组合拒绝
计费维度,取值之一:quantity-按购买量(席位) / usage-按用量 / mixed-混合(预留,本期拒绝);默认 quantity
用量阈值(新口径,替代金额口径 billing_threshold);后付费用量路线(billing_cycle_unit=over_threshold)时填写
数量单位名称(商品级展示用,默认 unit)
此页面对您有帮助吗?