Create Product
curl --request POST \
--url https://uat-api.clinkbill.com/api/product \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-Timestamp: <x-timestamp>' \
--data '
{
"name": "Pro Plan",
"localizedNames": {
"en-US": "Pro Plan",
"zh-CN": "专业版套餐"
},
"description": "Access to Pro features",
"image": "oss_xxxxx",
"taxCategory": "software_service",
"priceList": [
{
"currency": "USD",
"unitAmount": 29.99,
"priceType": "recurring",
"isDefaultPrice": true,
"recurringDetails": {
"interval": "quarter",
"intervalCount": 1,
"trialPeriodDays": 7,
"pricingModel": "flat_rate"
}
}
]
}
'HttpResponse<String> response = Unirest.post("https://uat-api.clinkbill.com/api/product")
.header("X-Timestamp", "<x-timestamp>")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Pro Plan\",\n \"localizedNames\": {\n \"en-US\": \"Pro Plan\",\n \"zh-CN\": \"专业版套餐\"\n },\n \"description\": \"Access to Pro features\",\n \"image\": \"oss_xxxxx\",\n \"taxCategory\": \"software_service\",\n \"priceList\": [\n {\n \"currency\": \"USD\",\n \"unitAmount\": 29.99,\n \"priceType\": \"recurring\",\n \"isDefaultPrice\": true,\n \"recurringDetails\": {\n \"interval\": \"quarter\",\n \"intervalCount\": 1,\n \"trialPeriodDays\": 7,\n \"pricingModel\": \"flat_rate\"\n }\n }\n ]\n}")
.asString();import requests
url = "https://uat-api.clinkbill.com/api/product"
payload = {
"name": "Pro Plan",
"localizedNames": {
"en-US": "Pro Plan",
"zh-CN": "专业版套餐"
},
"description": "Access to Pro features",
"image": "oss_xxxxx",
"taxCategory": "software_service",
"priceList": [
{
"currency": "USD",
"unitAmount": 29.99,
"priceType": "recurring",
"isDefaultPrice": True,
"recurringDetails": {
"interval": "quarter",
"intervalCount": 1,
"trialPeriodDays": 7,
"pricingModel": "flat_rate"
}
}
]
}
headers = {
"X-Timestamp": "<x-timestamp>",
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Timestamp': '<x-timestamp>',
'X-API-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Pro Plan',
localizedNames: {'en-US': 'Pro Plan', 'zh-CN': '专业版套餐'},
description: 'Access to Pro features',
image: 'oss_xxxxx',
taxCategory: 'software_service',
priceList: [
{
currency: 'USD',
unitAmount: 29.99,
priceType: 'recurring',
isDefaultPrice: true,
recurringDetails: {
interval: 'quarter',
intervalCount: 1,
trialPeriodDays: 7,
pricingModel: 'flat_rate'
}
}
]
})
};
fetch('https://uat-api.clinkbill.com/api/product', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": 123,
"msg": "<string>",
"data": {
"productId": "<string>",
"name": "<string>",
"active": true,
"description": "<string>",
"defaultPrice": "<string>",
"image": "<string>",
"priceList": [
{
"priceId": "<string>",
"priceSnapshotId": "<string>",
"productId": "<string>",
"unitAmount": 123,
"recurring": {
"trialPeriodDays": 123,
"transformQuantity": {
"divideBy": 123
},
"intervalCount": 123
},
"active": true,
"createTime": 123
}
],
"createTime": 123,
"updateTime": 123,
"localizedNames": {}
}
}"<string>"Product
创建产品
Create a product with one or more price configurations. Product names can include localized values for multiple languages.
POST
/
product
Create Product
curl --request POST \
--url https://uat-api.clinkbill.com/api/product \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-Timestamp: <x-timestamp>' \
--data '
{
"name": "Pro Plan",
"localizedNames": {
"en-US": "Pro Plan",
"zh-CN": "专业版套餐"
},
"description": "Access to Pro features",
"image": "oss_xxxxx",
"taxCategory": "software_service",
"priceList": [
{
"currency": "USD",
"unitAmount": 29.99,
"priceType": "recurring",
"isDefaultPrice": true,
"recurringDetails": {
"interval": "quarter",
"intervalCount": 1,
"trialPeriodDays": 7,
"pricingModel": "flat_rate"
}
}
]
}
'HttpResponse<String> response = Unirest.post("https://uat-api.clinkbill.com/api/product")
.header("X-Timestamp", "<x-timestamp>")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Pro Plan\",\n \"localizedNames\": {\n \"en-US\": \"Pro Plan\",\n \"zh-CN\": \"专业版套餐\"\n },\n \"description\": \"Access to Pro features\",\n \"image\": \"oss_xxxxx\",\n \"taxCategory\": \"software_service\",\n \"priceList\": [\n {\n \"currency\": \"USD\",\n \"unitAmount\": 29.99,\n \"priceType\": \"recurring\",\n \"isDefaultPrice\": true,\n \"recurringDetails\": {\n \"interval\": \"quarter\",\n \"intervalCount\": 1,\n \"trialPeriodDays\": 7,\n \"pricingModel\": \"flat_rate\"\n }\n }\n ]\n}")
.asString();import requests
url = "https://uat-api.clinkbill.com/api/product"
payload = {
"name": "Pro Plan",
"localizedNames": {
"en-US": "Pro Plan",
"zh-CN": "专业版套餐"
},
"description": "Access to Pro features",
"image": "oss_xxxxx",
"taxCategory": "software_service",
"priceList": [
{
"currency": "USD",
"unitAmount": 29.99,
"priceType": "recurring",
"isDefaultPrice": True,
"recurringDetails": {
"interval": "quarter",
"intervalCount": 1,
"trialPeriodDays": 7,
"pricingModel": "flat_rate"
}
}
]
}
headers = {
"X-Timestamp": "<x-timestamp>",
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Timestamp': '<x-timestamp>',
'X-API-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Pro Plan',
localizedNames: {'en-US': 'Pro Plan', 'zh-CN': '专业版套餐'},
description: 'Access to Pro features',
image: 'oss_xxxxx',
taxCategory: 'software_service',
priceList: [
{
currency: 'USD',
unitAmount: 29.99,
priceType: 'recurring',
isDefaultPrice: true,
recurringDetails: {
interval: 'quarter',
intervalCount: 1,
trialPeriodDays: 7,
pricingModel: 'flat_rate'
}
}
]
})
};
fetch('https://uat-api.clinkbill.com/api/product', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": 123,
"msg": "<string>",
"data": {
"productId": "<string>",
"name": "<string>",
"active": true,
"description": "<string>",
"defaultPrice": "<string>",
"image": "<string>",
"priceList": [
{
"priceId": "<string>",
"priceSnapshotId": "<string>",
"productId": "<string>",
"unitAmount": 123,
"recurring": {
"trialPeriodDays": 123,
"transformQuantity": {
"divideBy": 123
},
"intervalCount": 123
},
"active": true,
"createTime": 123
}
],
"createTime": 123,
"updateTime": 123,
"localizedNames": {}
}
}"<string>"授权
Your secret API key obtained from the Clink dashboard (Developers section)
请求头
Current timestamp in milliseconds since Unix epoch (required for request signing)
示例:
"1783513683000"
请求体
application/json
Parameters required to create a product by API
Default product name
Uploaded product image OSS ID
Product tax category
可用选项:
digital_goods_or_service, ebook, software_service Localized product names. Key is a language or locale code, value is the localized product name.
Show child attributes
Show child attributes
Product description
Default price ID. Usually omitted when creating a new product with priceList.
Prices to create with this product
Show child attributes
Show child attributes
⌘I