激活或停用产品。活跃产品可购买;已停用产品从结账中隐藏。
POST /v1/actions/onetime-product/update-status
认证方式: API Key
请求体
| 字段 | 类型 | 必需 | 说明 |
|---|
id | string | 是 | 产品 ID(Short ID 格式 PROD_xxx) |
status | string | 是 | active 或 inactive |
请求示例
import { ProductVersionStatus } from "@waffo/pancake-ts";
const { product } = await client.onetimeProducts.updateStatus({
id: "PROD_3kF9mNpQrStUvWxYz1A2bC",
status: ProductVersionStatus.Inactive,
});
响应字段
与创建产品响应相同。
将产品设为 inactive 会从结账中隐藏,但不会影响现有订单。已购买该产品的客户保留访问权限。
错误响应
| 状态码 | 错误 | 说明 |
|---|
| 400 | Missing required field: id | 未提供 id |
| 400 | Invalid status value | status 不是 active 或 inactive |
| 400 | No version in current environment | 产品在当前环境(测试/生产)中没有版本 |
| 404 | Product not found | 产品不存在或不可访问 |