> ## 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.

# サブスクリプション商品エンドポイント

> サブスクリプション商品と商品グループの作成と管理

サブスクリプション商品は、設定可能な請求サイクルとマルチ通貨価格設定による定期課金をサポートしています。商品はグループに整理して、共有トライアル管理や階層型価格プランを実現できます。

## 請求サイクル

| 期間          | 頻度     |
| ----------- | ------ |
| `weekly`    | 7日ごと   |
| `monthly`   | 毎月     |
| `quarterly` | 3か月ごと  |
| `yearly`    | 12か月ごと |

## グループオブジェクト

商品グループは関連するサブスクリプション商品（例：Free、Pro、Enterprise プラン）を整理し、グループ内の商品間で共有トライアル管理を可能にします。各グループは環境ごとに存在し、テスト用と本番用に1つずつあります。

```json theme={"system"}
{
  "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"
}
```

<Note>
  グループ ID は **UUID 形式**であり、Short ID 形式ではありません。これは API で生の UUID を使用する唯一のエンティティです。
</Note>

| フィールド         | 型              | 説明                                          |
| ------------- | -------------- | ------------------------------------------- |
| `id`          | string         | Group ID (UUID format)                      |
| `storeId`     | string         | Store ID (`STO_xxx` format)                 |
| `name`        | string         | Group name (unique per store + environment) |
| `description` | string \| null | Group description                           |
| `rules`       | object         | Group rules (see below)                     |
| `productIds`  | string\[]      | List of product IDs (`PROD_xxx` format)     |
| `environment` | string         | `test` or `prod`                            |
| `createdAt`   | string         | ISO 8601 timestamp                          |
| `updatedAt`   | string         | ISO 8601 timestamp                          |

### ルール

| フィールド         | 型       | デフォルト   | 説明                                                                                                                                                                                |
| ------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sharedTrial` | boolean | `false` | When `true`, trial usage is shared across all products in the group. Prevents customers from signing up for repeated free trials by switching between products in the same group. |

## エンドポイント

<CardGroup cols={2}>
  <Card title="商品の作成" icon="plus" href="/api-reference/endpoints/subscription-products/create-product">
    請求サイクルとマルチ通貨対応のサブスクリプション商品を作成します。
  </Card>

  <Card title="商品の更新" icon="pen" href="/api-reference/endpoints/subscription-products/update-product">
    サブスクリプション商品のコンテンツを更新します。コンテンツが変更された場合、新しいイミュータブルバージョンが作成されます。
  </Card>

  <Card title="商品の公開" icon="rocket" href="/api-reference/endpoints/subscription-products/publish-product">
    サブスクリプション商品をテストから本番に公開します（初回公開のみ）。
  </Card>

  <Card title="ステータスの更新" icon="toggle-on" href="/api-reference/endpoints/subscription-products/update-status">
    サブスクリプション商品を有効化または無効化します。
  </Card>

  <Card title="グループの作成" icon="layer-group" href="/api-reference/endpoints/subscription-products/create-group">
    関連するサブスクリプション商品を整理するための商品グループを作成します。
  </Card>

  <Card title="グループの更新" icon="pen-to-square" href="/api-reference/endpoints/subscription-products/update-group">
    商品グループの名前、説明、ルール、または商品リストを更新します。
  </Card>

  <Card title="グループの削除" icon="trash" href="/api-reference/endpoints/subscription-products/delete-group">
    商品グループを完全に削除します。
  </Card>

  <Card title="グループの公開" icon="rocket" href="/api-reference/endpoints/subscription-products/publish-group">
    テストから本番に商品グループを公開します（繰り返しの UPSERT をサポート）。
  </Card>
</CardGroup>
