# asc: アプリ内課金とサブスクリプション

> アプリ内課金、サブスクリプションとその価格・オファー・審査、アプリ内イベント、App Store Server API を扱う asc コマンド。

Source: https://air.build/ja/docs/cli/asc-monetization/

ここで紹介する [asc](https://air.build/ja/docs/cli/asc/) のコマンド群は、アプリで販売するものを管理します。Apple チームの選択（`--auth`）、出力、ページ送り、`--confirm`、終了コードの扱いは [asc](https://air.build/ja/docs/cli/asc/) のページで説明しているとおりです。アプリの価格と配信地域は `asc pricing` にあります（[asc: アプリと App Store 掲載情報](https://air.build/ja/docs/cli/asc-apps/)を参照）。

以下の表の**主なフラグ**には、ほぼすべてのコマンドにあるフラグは載せていません。対象は `--output` と `--pretty`（[出力](https://air.build/ja/docs/cli/asc/#output)を参照）、一覧系コマンドの `--limit`、`--next`、`--paginate`（[ページ送り](https://air.build/ja/docs/cli/asc/#pagination)を参照）、そして Apple が返す属性を選ぶ `--…-fields` フラグです。すべてのフラグとその値、使用例は `asc <family> <subcommand> --help` で確認できます。サブコマンドがさらにサブコマンドを持つ場合は、フラグの代わりにそれらを載せています。

## ワンステップで作成する

`iap setup` と `subscriptions setup` は、App Store Connect が必要とする情報をそろえた商品を 1 つのコマンドで作成します。

```bash
asc iap setup --app APP_ID --type NON_CONSUMABLE --reference-name "Pro Lifetime" \
  --product-id com.example.lifetime --price 3.99 --base-territory "United States"

asc subscriptions setup --app APP_ID --group-reference-name "Pro" --reference-name "Pro Monthly" \
  --product-id com.example.pro.monthly --subscription-period ONE_MONTH \
  --price 3.99 --price-territory "United States" --territories "US,Canada"
```

| フラグ | コマンド | 内容 |
| --- | --- | --- |
| `--type` | `iap` | `CONSUMABLE`、`NON_CONSUMABLE`、`NON_RENEWING_SUBSCRIPTION` のいずれか。 |
| `--reference-name`, `--product-id` | 両方 | 内部名と製品 ID。 |
| `--locale`, `--display-name`, `--description` | 両方 | 最初のローカライズ。 |
| `--price`, `--tier` or `--price-point-id` | 両方 | 最初の価格。顧客向け価格、ティア番号、または正確な価格ポイントで指定します。 |
| `--base-territory` / `--price-territory` | `iap` / `subscriptions` | 価格を設定する地域。2 文字または 3 文字のコード、または英語名。 |
| `--start-date` | 両方 | 価格の開始日（`YYYY-MM-DD`）。 |
| `--review-note` | 両方 | App Review へのメモ。 |
| `--family-sharable` | 両方 | ファミリー共有をオンにします。元に戻せません。 |
| `--group-id` or `--group-reference-name` | `subscriptions` | 既存のサブスクリプショングループ、または新しく作るグループの名前。`--group-display-name`、`--group-locale`、`--group-custom-app-name` でローカライズし、`--group-level` で順序を設定します。 |
| `--subscription-period` | `subscriptions` | `ONE_WEEK`、`ONE_MONTH`、`TWO_MONTHS`、`THREE_MONTHS`、`SIX_MONTHS`、`ONE_YEAR`。 |
| `--territories`, `--available-in-new-territories` | `subscriptions` | 販売する地域。 |
| `--review-screenshot` | `subscriptions` | App Review 用のスクリーンショット。 |
| `--enable-monthly-commitment` | `subscriptions` | `ONE_YEAR` の場合に、12 か月契約の月額プランも提供します。 |
| `--no-verify` | 両方 | Apple から結果を読み戻す確認を省略します。 |

`subscriptions setup` は Apple の均等化価格をもとにすべての地域の価格を設定し、既定ではサブスクリプションを読み戻して、Apple がまだメタデータ不足（`MISSING_METADATA`）と報告していれば失敗します。`--repair` は価格マトリクス全体を作り直して保存し直します。

サブスクリプションのバージョンを審査に出すには、審査提出に追加します: `asc review items add --submission SUBMISSION_ID --item-type subscriptionVersions --item-id SUBSCRIPTION_VERSION_ID`（[asc: 審査とリリース](https://air.build/ja/docs/cli/asc-release/)を参照）。事前に `asc validate iap` と `asc validate subscriptions` で準備ができているか確認できます。

## iap

App Store Connect のアプリ内課金を管理します。

| サブコマンド | 内容 | 主なフラグ |
| --- | --- | --- |
| `list` | アプリのアプリ内課金を一覧表示します。 | `--app`, `--include`, `--include-versions`, `--legacy`, `--name`, `--product-id`, `--sort`, `--state`, `--type`, `--versions-limit` |
| `versions` | バージョン管理されたアプリ内課金の審査用コンテンツを管理します。 | サブコマンド: `create`, `list`, `view`, `image`, `images`, `localizations`, `links`, `submit` |
| `pricing` | アプリ内課金の価格設定を管理します。 | サブコマンド: `summary`, `price-points`, `schedules`, `ppp`, `availability`, `availabilities` |
| `view` | ID を指定してアプリ内課金を表示します。 | `--id`, `--include`, `--include-versions`, `--legacy`, `--versions-limit` |
| `create` | 新しいアプリ内課金を作成します。 | `--app`, `--family-sharable`, `--product-id`, `--ref-name`, `--review-note`, `--type` |
| `import` | JSON ファイルからアプリ内課金をまとめて作成します。 | `--app`, `--confirm`, `--dry-run`, `--file`, `--skip-existing` |
| `setup` | アプリ内課金を作成し、必要なら価格も設定します。 | `--app`, `--base-territory`, `--description`, `--display-name`, `--family-sharable`, `--locale`, `--no-verify`, `--price`, `--price-point-id`, `--product-id`, `--reference-name`, `--refresh`, `--review-note`, `--start-date`, `--tier`, `--type` |
| `update` | アプリ内課金を更新します。 | `--family-sharable`, `--id`, `--ref-name`, `--review-note` |
| `delete` | アプリ内課金を削除します。 | `--confirm`, `--id` |
| `review-screenshots` | アプリ内課金の審査用スクリーンショットを管理します。 | サブコマンド: `view`, `create`, `update`, `delete` |
| `promoted-purchases` | アプリ内課金のプロモーション購入を管理します。 | サブコマンド: `list`, `view`, `create`, `update`, `delete`, `link` |
| `content` | アプリ内課金のコンテンツメタデータを取得します。 | サブコマンド: `view` |
| `offer-codes` | アプリ内課金のオファーコードを管理します。 | サブコマンド: `list`, `view`, `create`, `update`, `custom-codes`, `one-time-codes`, `prices` |

## subscriptions

サブスクリプショングループとサブスクリプションを管理します。

| サブコマンド | 内容 | 主なフラグ |
| --- | --- | --- |
| `groups` | サブスクリプショングループを管理します。 | サブコマンド: `list`, `create`, `view`, `update`, `delete`, `versions` |
| `list` | グループまたはアプリのサブスクリプションを一覧表示します。 | `--app`, `--group-id`, `--include`, `--versions-limit` |
| `create` | サブスクリプションを作成します。 | `--family-sharable`, `--group-id`, `--group-level`, `--product-id`, `--reference-name`, `--review-note`, `--subscription-period` |
| `setup` | App Store のメタデータをすべてそろえたサブスクリプションを作成、または既存のものと整合させます。 | `--app`, `--available-in-new-territories`, `--description`, `--display-name`, `--enable-monthly-commitment`, `--family-sharable`, `--group-custom-app-name`, `--group-display-name`, `--group-id`, `--group-level`, `--group-locale`, `--group-reference-name`, `--locale`, `--no-verify`, `--price`, `--price-point-id`, `--price-territory`, `--product-id`, `--reference-name`, `--refresh`, `--repair`, `--review-note`, `--review-screenshot`, `--start-date`, `--subscription-period`, `--territories`, `--tier` |
| `view` | ID を指定してサブスクリプションを表示します。 | `--id`, `--include`, `--versions-limit` |
| `update` | サブスクリプションを更新します。 | `--family-sharable`, `--group-level`, `--id`, `--market-settings`, `--multi-seat-status`, `--reference-name`, `--review-note`, `--subscription-period` |
| `delete` | サブスクリプションを削除します。 | `--confirm`, `--id` |
| `pricing` | サブスクリプションの価格設定を管理します。 | サブコマンド: `summary`, `prices`, `price-points`, `availability`, `plan-availability`, `monthly-commitment`, `equalize`, `derive`, `ppp` |
| `offers` | サブスクリプションのオファーを管理します。 | サブコマンド: `introductory`, `promotional`, `offer-codes`, `win-back`, `retention` |
| `review` | サブスクリプションの審査を管理します。 | サブコマンド: `screenshots`, `app-store-screenshot` |
| `promoted-purchases` | サブスクリプションのプロモーション購入を管理します。 | サブコマンド: `list`, `view`, `create`, `update`, `delete`, `link` |
| `versions` | バージョン単位のサブスクリプションメタデータを管理します。 | サブコマンド: `create`, `list`, `view`, `links`, `localizations`, `images` |
| `grace-periods` | サブスクリプションの猶予期間を確認します。 | サブコマンド: `view`, `update` |
| `retention-messages` | サブスクリプションの解約時に表示するリテンションメッセージを管理します。 | サブコマンド: `list`, `view`, `create`, `delete`, `assigned`, `assign`, `subscriptions`, `versions`, `localizations`, `links` |

## app-events

App Store のアプリ内イベントを管理します。

| サブコマンド | 内容 | 主なフラグ |
| --- | --- | --- |
| `list` | アプリのアプリ内イベントを一覧表示します。 | `--app`, `--event-state`, `--id`, `--include`, `--localizations-limit` |
| `view` | ID を指定してアプリ内イベントを表示します。 | `--event-id` |
| `create` | 新しいアプリ内イベントを作成します。 | `--app`, `--deep-link`, `--end`, `--event-type`, `--name`, `--primary-locale`, `--priority`, `--publish-start`, `--purchase-requirement`, `--purpose`, `--start`, `--territories` |
| `update` | アプリ内イベントを更新します。 | `--deep-link`, `--end`, `--event-id`, `--event-type`, `--name`, `--primary-locale`, `--priority`, `--publish-start`, `--purchase-requirement`, `--purpose`, `--start`, `--territories` |
| `delete` | アプリ内イベントを削除します。 | `--confirm`, `--event-id` |
| `localizations` | アプリ内イベントのローカライズを管理します。 | サブコマンド: `list`, `view`, `screenshots`, `video-clips`, `screenshots-links`, `video-clips-links`, `create`, `update`, `delete`, `placements` |
| `links` | アプリ内イベントのローカライズとの関連を一覧表示します。 | `--event-id` |
| `screenshots` | アプリ内イベントのスクリーンショットを管理します。 | サブコマンド: `list`, `links`, `view`, `create`, `delete` |
| `video-clips` | アプリ内イベントのビデオクリップを管理します。 | サブコマンド: `list`, `links`, `view`, `create`, `set-poster-frame`, `delete` |
| `submit` | アプリ内イベントを審査に提出します。 | `--app`, `--confirm`, `--event-id`, `--platform` |

## storekit

アプリ内課金 API キーで StoreKit のサーバー API を扱います。

| サブコマンド | 内容 | 主なフラグ |
| --- | --- | --- |
| `auth` | StoreKit 用のアプリ内課金 API 認証情報を管理します。 | サブコマンド: `login`, `status`, `switch`, `doctor`, `logout` |
| `transactions` | App Store Server API でアプリ内課金のトランザクションを読み取り、管理します。 | サブコマンド: `view`, `history`, `set-account-token`, `send-consumption`, `finish` |
| `app-transactions` | 署名付きのアプリ購入情報を読み取ります。 | サブコマンド: `view` |
| `subscriptions` | App Store Server API でサブスクリプションの状態を読み取り、更新日を延長します。 | サブコマンド: `status`, `extend`, `extend-all`, `extension-status` |
| `refunds` | App Store Server API で顧客の返金済みアプリ内課金を読み取ります。 | サブコマンド: `history` |
| `orders` | 注文 ID から顧客のアプリ内課金を検索します。 | サブコマンド: `lookup` |
| `notifications` | App Store Server Notifications の履歴を読み取り、テスト通知を送信します。 | サブコマンド: `history`, `test`, `test-status` |
| `groups` | マルチシートの顧客グループとそのメンバーを読み取ります。 | サブコマンド: `list`, `members` |
| `retention-messaging` | サブスクリプションの Retention Messaging リソースを管理します。 | サブコマンド: `images`, `messages`, `defaults`, `endpoint`, `performance` |

`storekit` は App Store Server API（トランザクション、サブスクリプションの状態、返金、注文検索、サーバー通知、リテンションメッセージ）を呼び出します。AirBuild に接続した Apple チームとは別に、専用のアプリ内課金 API キーが必要です。`asc storekit auth login --name NAME --key-id KEY_ID --issuer-id ISSUER_ID --private-key ./SubscriptionKey.p8 --bundle-id com.example.app` で登録し、`asc storekit auth status` で確認します。ほとんどの `storekit` コマンドは `--environment production` または `sandbox` を受け付けます。

## 使用例

アプリのアプリ内課金と価格を一覧表示する:

```bash
asc iap list --app "APP_ID" --paginate --output table
asc iap pricing summary --app "APP_ID"
```

サブスクリプションのオファーコードを作成する:

```bash
asc subscriptions offers offer-codes generate --offer-code-id "OFFER_CODE_ID" --quantity 10 --expiration-date "2026-02-01"
```

アプリ内イベントを作成して提出する:

```bash
asc app-events create --app "APP_ID" --name "Summer Challenge" --event-type CHALLENGE \
  --start "2026-06-01T00:00:00Z" --end "2026-06-30T23:59:59Z"
asc app-events submit --app "APP_ID" --event-id "EVENT_ID" --confirm
```
