> ## Documentation Index
> Fetch the complete documentation index at: https://docs.waffo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 删除产品组

> 永久删除产品组

永久删除产品组。组内的商品不受影响。

```
POST /v1/actions/subscription-product-group/delete-group
```

**认证方式：** API Key

## 请求体

| 字段   | 类型     | 必需 | 说明              |
| ---- | ------ | -- | --------------- |
| `id` | string | 是  | 产品组 ID（UUID 格式） |

## 请求示例

<CodeGroup>
  ```typescript SDK theme={"system"}
  await client.subscriptionProductGroups.delete({
    id: "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
  });
  ```

  ```typescript TypeScript (fetch) theme={"system"}
  // Uses callApi() helper from authentication.mdx
  const result = await callApi("POST", "/v1/actions/subscription-product-group/delete-group", {
    id: "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
  });
  console.log(result.data);
  ```

  ```java Java theme={"system"}
  // Uses callApi() helper from authentication.mdx
  String body = """
      {"id":"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a"}""";

  String response = callApi("POST", "/v1/actions/subscription-product-group/delete-group", body);
  System.out.println(response);
  ```

  ```python Python theme={"system"}
  # Uses call_api() helper from authentication.mdx
  result = call_api("POST", "/v1/actions/subscription-product-group/delete-group", {
      "id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
  })
  print(result["data"])
  ```

  ```go Go theme={"system"}
  // Uses callAPI() helper from authentication.mdx
  body := map[string]interface{}{
      "id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
  }
  result, err := callAPI("POST", "/v1/actions/subscription-product-group/delete-group", body)
  if err != nil {
      log.Fatal(err)
  }
  fmt.Println(string(result))
  ```

  ```rust Rust theme={"system"}
  // Uses call_api() helper from authentication.mdx
  let body = serde_json::json!({
      "id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a"
  });
  let result = call_api("POST", "/v1/actions/subscription-product-group/delete-group", &body).await?;
  println!("{}", result);
  ```

  ```c C theme={"system"}
  /* Uses call_api() helper from authentication.mdx */
  const char *body = "{\"id\":\"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a\"}";
  char *response = call_api("POST", "/v1/actions/subscription-product-group/delete-group", body);
  printf("%s\n", response);
  free(response);
  ```

  ```cpp C++ theme={"system"}
  // Uses callApi() helper from authentication.mdx
  std::string body = R"({"id":"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a"})";
  std::string response = callApi("POST", "/v1/actions/subscription-product-group/delete-group", body);
  std::cout << response << std::endl;
  ```

  ```bash cURL theme={"system"}
  MERCHANT_ID="MER_2aUyqjCzEIiEcYMKj7TZtw"
  TIMESTAMP=$(date +%s)
  BODY='{"id":"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a"}'
  BODY_HASH=$(echo -n "$BODY" | openssl dgst -sha256 -binary | base64 -w 0)
  CANONICAL_REQUEST="POST
  /v1/actions/subscription-product-group/delete-group
  $TIMESTAMP
  $BODY_HASH"

  SIGNATURE=$(echo -n "$CANONICAL_REQUEST" | openssl dgst -sha256 -sign private_key.pem | base64 -w 0)

  curl -X POST "https://api.waffo.ai/v1/actions/subscription-product-group/delete-group" \
    -H "Content-Type: application/json" \
    -H "X-Merchant-Id: $MERCHANT_ID" \
    -H "X-Timestamp: $TIMESTAMP" \
    -H "X-Signature: $SIGNATURE" \
    -d "$BODY"
  ```

  ```bash wget theme={"system"}
  MERCHANT_ID="MER_2aUyqjCzEIiEcYMKj7TZtw"
  TIMESTAMP=$(date +%s)
  BODY='{"id":"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a"}'
  BODY_HASH=$(echo -n "$BODY" | openssl dgst -sha256 -binary | base64 -w 0)
  CANONICAL_REQUEST="POST
  /v1/actions/subscription-product-group/delete-group
  $TIMESTAMP
  $BODY_HASH"

  SIGNATURE=$(echo -n "$CANONICAL_REQUEST" | openssl dgst -sha256 -sign private_key.pem | base64 -w 0)

  wget -qO- "https://api.waffo.ai/v1/actions/subscription-product-group/delete-group" \
    --header="Content-Type: application/json" \
    --header="X-Merchant-Id: $MERCHANT_ID" \
    --header="X-Timestamp: $TIMESTAMP" \
    --header="X-Signature: $SIGNATURE" \
    --post-data="$BODY"
  ```
</CodeGroup>

<Warning>
  这是**永久硬删除**。组内的商品不会被删除 -- 仅移除分组关系。
</Warning>

## 错误响应

> **重试策略**：4xx 一律不要重试 — 修正请求后重发。5xx 指数退避重试（起步 5s，最多 3 次）。

| 状态码 | `errors[0].message`          | 含义               | 推荐处理                 |
| --- | ---------------------------- | ---------------- | -------------------- |
| 400 | `Missing required field: id` | 请求体缺少 `id`       | 补齐 `id` 后重发          |
| 404 | `Group not found`            | 产品组已被删除或从未属于你的门店 | 验证 `id`              |
| 500 | `Internal server error`      | 内部错误或瞬时下游故障      | 指数退避重试（起步 5s，最多 3 次） |
