跳转到主要内容
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>"

授权

X-API-KEY
string
header
必填

Your secret API key obtained from the Clink dashboard (Developers section)

请求头

X-Timestamp
string
必填

Current timestamp in milliseconds since Unix epoch (required for request signing)

示例:

"1783513683000"

请求体

application/json

Parameters required to create a product by API

name
string
必填

Default product name

image
string
必填

Uploaded product image OSS ID

taxCategory
enum<string>
必填

Product tax category

可用选项:
digital_goods_or_service,
ebook,
software_service
localizedNames
object

Localized product names. Key is a language or locale code, value is the localized product name.

description
string

Product description

defaultPrice
string

Default price ID. Usually omitted when creating a new product with priceList.

priceList
object[]

Prices to create with this product

响应

Product created successfully

Body of the response message

code
integer<int32>

Response status code, 200 when success

msg
string

Brief description of what happened, success when happy case

data
object