asc:App 内购买项目与订阅
用于 App 内购买项目、订阅及其价格、优惠与审核、App 内活动以及 App Store Server API 的 asc 命令。
这些 asc 命令族管理 App 售卖的内容。选择 Apple 团队(--auth)、输出、分页、--confirm 和退出码的用法见 asc 页面。App 价格和销售范围在 asc pricing 下(见 asc:App 与 App Store 产品页)。
下表的 主要参数 一栏省略了几乎每个命令都有的参数:--output 和 --pretty(见输出)、列表命令的 --limit、--next 和 --paginate(见分页),以及用来选择 Apple 返回哪些属性的 --…-fields 参数。运行 asc <family> <subcommand> --help 可查看全部参数、取值和示例。如果某个子命令还有自己的子命令,则列出这些子命令。
一步创建
iap setup 和 subscriptions setup 用一条命令创建一个带齐 App Store Connect 所需信息的产品:
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 |
设定价格所在的国家或地区。可用两位或三位代码,或英文名称。 |
--start-date |
两者 | 价格生效日期(YYYY-MM-DD)。 |
--review-note |
两者 | 给 App 审核的备注。 |
--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 审核用的截屏。 |
--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:审核与发布)。可以先用 asc validate iap 和 asc validate subscriptions 检查是否就绪。
iap
在 App Store Connect 中管理 App 内购买项目。
| 子命令 | 作用 | 主要参数 |
|---|---|---|
list |
列出某个 App 的 App 内购买项目。 | --app, --include, --include-versions, --legacy, --name, --product-id, --sort, --state, --type, --versions-limit |
versions |
管理按版本区分的 App 内购买项目审核内容。 | 子命令:create, list, view, image, images, localizations, links, submit |
pricing |
管理 App 内购买项目的定价流程。 | 子命令:summary, price-points, schedules, ppp, availability, availabilities |
view |
按 ID 查看 App 内购买项目。 | --id, --include, --include-versions, --legacy, --versions-limit |
create |
新建 App 内购买项目。 | --app, --family-sharable, --product-id, --ref-name, --review-note, --type |
import |
从 JSON 文件批量创建 App 内购买项目。 | --app, --confirm, --dry-run, --file, --skip-existing |
setup |
创建 App 内购买项目,可同时设定价格。 | --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 |
更新 App 内购买项目。 | --family-sharable, --id, --ref-name, --review-note |
delete |
删除 App 内购买项目。 | --confirm, --id |
review-screenshots |
管理 App 内购买项目的审核截屏。 | 子命令:view, create, update, delete |
promoted-purchases |
管理 App 内购买项目的推广购买。 | 子命令:list, view, create, update, delete, link |
content |
获取 App 内购买项目的内容元数据。 | 子命令:view |
offer-codes |
管理 App 内购买项目的优惠代码。 | 子命令:list, view, create, update, custom-codes, one-time-codes, prices |
subscriptions
管理订阅群组和订阅。
| 子命令 | 作用 | 主要参数 |
|---|---|---|
groups |
管理订阅群组。 | 子命令:list, create, view, update, delete, versions |
list |
列出某个群组或 App 中的订阅。 | --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 的 App 内活动。
| 子命令 | 作用 | 主要参数 |
|---|---|---|
list |
列出某个 App 的 App 内活动。 | --app, --event-state, --id, --include, --localizations-limit |
view |
按 ID 查看 App 内活动。 | --event-id |
create |
新建 App 内活动。 | --app, --deep-link, --end, --event-type, --name, --primary-locale, --priority, --publish-start, --purchase-requirement, --purpose, --start, --territories |
update |
更新 App 内活动。 | --deep-link, --end, --event-id, --event-type, --name, --primary-locale, --priority, --publish-start, --purchase-requirement, --purpose, --start, --territories |
delete |
删除 App 内活动。 | --confirm, --event-id |
localizations |
管理 App 内活动的本地化。 | 子命令:list, view, screenshots, video-clips, screenshots-links, video-clips-links, create, update, delete, placements |
links |
列出 App 内活动的本地化关联。 | --event-id |
screenshots |
管理 App 内活动截屏。 | 子命令:list, links, view, create, delete |
video-clips |
管理 App 内活动视频片段。 | 子命令:list, links, view, create, set-poster-frame, delete |
submit |
提交 App 内活动以供审核。 | --app, --confirm, --event-id, --platform |
storekit
使用 App 内购买项目 API 密钥管理 StoreKit 服务器 API。
| 子命令 | 作用 | 主要参数 |
|---|---|---|
auth |
管理 StoreKit 使用的 App 内购买项目 API 凭证。 | 子命令:login, status, switch, doctor, logout |
transactions |
通过 App Store Server API 读取和管理 App 内购买交易。 | 子命令:view, history, set-account-token, send-consumption, finish |
app-transactions |
读取已签名的 App 购买信息。 | 子命令:view |
subscriptions |
通过 App Store Server API 读取订阅状态并延长续订日期。 | 子命令:status, extend, extend-all, extension-status |
refunds |
通过 App Store Server API 读取顾客已退款的 App 内购买项目。 | 子命令:history |
orders |
按订单号查询顾客的 App 内购买项目。 | 子命令:lookup |
notifications |
读取 App Store 服务器通知历史并发送测试通知。 | 子命令:history, test, test-status |
groups |
读取多席位顾客群组及其成员。 | 子命令:list, members |
retention-messaging |
管理订阅挽留消息(Retention Messaging)资源。 | 子命令:images, messages, defaults, endpoint, performance |
storekit 调用 App Store Server API(交易、订阅状态、退款、订单查询、服务器通知、挽留消息)。它需要单独的 App 内购买项目 API 密钥,与 AirBuild 中连接的 Apple 团队分开:用 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。
示例
列出某个 App 的 App 内购买项目及其价格:
asc iap list --app "APP_ID" --paginate --output table
asc iap pricing summary --app "APP_ID"为订阅生成优惠代码:
asc subscriptions offers offer-codes generate --offer-code-id "OFFER_CODE_ID" --quantity 10 --expiration-date "2026-02-01"创建一个 App 内活动并提交:
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