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 |
依訂單 ID 查詢顧客的 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