创建定价方案
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>"
}
}商品定价
创建定价方案
创建定价方案
POST
/
api
/
v1
/
prices
创建定价方案
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}
请求头
请求的唯一标识符
请求体
application/json
创建定价方案请求
定价方案名称
关联商品 ID
商品版本 ID
计费类型:one_time-一次性 / recurring-周期性
定价描述
定价类型,取值之一:flat_price | package_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 为 based_on_usage 或 package_price 时必填
用量单位,当 price_type 为 based_on_usage 或 package_price 时必填
定价权益列表
Show child attributes
Show child attributes
定价模型类型,取值之一:per_unit | tiers_price,当 price_type 为 based_on_usage 时必填
扣费阈值,当 model_type 为 per_unit 时必填
试用类型:0-免费试用 | 1-付费试用
试用价格,当 trial_type 为 1(付费试用)时必填
状态:
- draft:草稿
- active:已激活
- frozen:已冻结
此页面对您有帮助吗?
⌘I