POST /v1/actions/subscription-product-group/create-group
请求体
| 字段 | 类型 | 必需 | 说明 |
|---|---|---|---|
storeId | string | 是 | Store ID(STO_xxx 格式) |
name | string | 是 | 组名称(每个门店 + 环境唯一) |
description | string | 否 | 组描述 |
rules | object | 否 | 组规则({ sharedTrial: boolean }) |
productIds | string[] | 否 | 要包含的订阅商品 ID(PROD_xxx 格式) |
请求示例
const { group } = await client.subscriptionProductGroups.create({
storeId: "STO_2D5F8G3H1K4M6N9P",
name: "Pricing Plans",
description: "Free, Pro, and Enterprise tiers",
rules: { sharedTrial: true },
productIds: [
"PROD_3F7H2J5L8N1Q4S6U",
"PROD_8B4D6F9H2K5M7P1R",
"PROD_1C3E5G7J0L2N4Q6S",
],
});
curl -X POST https://api.waffo.ai/v1/actions/subscription-product-group/create-group \
-H "Content-Type: application/json" \
-H "X-Merchant-Id: MER_7K3M9P2R5T8W1Y4Z" \
-H "X-Timestamp: 2026-03-30T10:00:00Z" \
-H "X-Signature: BASE64_RSA_SIGNATURE" \
-d '{
"storeId": "STO_2D5F8G3H1K4M6N9P",
"name": "Pricing Plans",
"description": "Free, Pro, and Enterprise tiers",
"rules": { "sharedTrial": true },
"productIds": [
"PROD_3F7H2J5L8N1Q4S6U",
"PROD_8B4D6F9H2K5M7P1R",
"PROD_1C3E5G7J0L2N4Q6S"
]
}'
body = {
"storeId": "STO_2D5F8G3H1K4M6N9P",
"name": "Pricing Plans",
"description": "Free, Pro, and Enterprise tiers",
"rules": {"sharedTrial": True},
"productIds": [
"PROD_3F7H2J5L8N1Q4S6U",
"PROD_8B4D6F9H2K5M7P1R",
"PROD_1C3E5G7J0L2N4Q6S",
],
}
response = requests.post(
"https://api.waffo.ai/v1/actions/subscription-product-group/create-group",
json=body,
headers=sign_request("POST", "/v1/actions/subscription-product-group/create-group", body),
)
group = response.json()["data"]["group"]
成功响应 (200)
{
"data": {
"group": {
"id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
"storeId": "STO_2D5F8G3H1K4M6N9P",
"name": "Pricing Plans",
"description": "Free, Pro, and Enterprise tiers",
"rules": { "sharedTrial": true },
"productIds": [
"PROD_3F7H2J5L8N1Q4S6U",
"PROD_8B4D6F9H2K5M7P1R",
"PROD_1C3E5G7J0L2N4Q6S"
],
"environment": "test",
"createdAt": "2026-03-30T10:30:00.000Z",
"updatedAt": "2026-03-30T10:30:00.000Z"
}
}
}
错误响应
重试策略:4xx 一律不要重试 — 修正请求后重发。5xx 指数退避重试(起步 5s,最多 3 次)。
| 状态码 | errors[0].message | 含义 | 推荐处理 |
|---|---|---|---|
| 400 | Missing or invalid header: x-context-environment | environment 请求头缺失或不是 test / prod | 修正请求头后重发 |
| 400 | Missing required fields: storeId, name | 必填字段缺失 | 补齐字段后重发 |
| 400 | Expected format: STO_xxx, got "..." / Expected format: PROD_xxx, got "..." | storeId 或 productIds 中的 Short ID 无法解码 | 修正 ID 后重发 |
| 500 | Internal server error | 内部错误或瞬时下游故障 | 指数退避重试(起步 5s,最多 3 次) |