跳过内容

创建iOS自动续订订阅

GitHub

Auto-renewable subscriptions provide recurring access to content, services, or premium features in your iOS app. This guide walks you through creating subscriptions in App Store Connect.

Auto-renewable subscriptions automatically renew at the end of each billing period until users cancel. They’re perfect for:

  • Premium content and features
  • Ad-free experiences
  • Cloud storage and sync
  • Streaming services
  • Professional tools and utilities

Prerequisites

创建前提条件

在创建订阅之前,必须:

  1. 创建订阅组 以组织您的订阅
  2. 拥有有效的Apple Developer Program会员资格
  3. 在App Store Connect中完成银行和税务信息

创建订阅

创建订阅
  1. 在App Store Connect中,选择您的应用程序并转到

    Monetize > 订阅 选择您的订阅组或如果需要则创建一个新的.

    Select your subscription group or create a new one if needed.

    前往订阅

  2. 创建新订阅

    点击 + 订阅组旁边的图标添加新订阅。

  3. 输入基本信息

    参考名称:用于内部使用的描述性名称(不向客户显示)

    • 例如:“Premium 月度”,“Ultimate 年度”,“基本计划”

    产品 ID:此订阅的唯一标识符(不能在以后更改)

    • 格式: com.yourcompany.yourapp.premium_monthly
    • 使用描述性、小写的名称,使用下划线
    • 用于配置 native-purchases 插件的必备项

    输入订阅详细信息

  4. 配置时长

    从可用选项中选择订阅时长:

    • 1 周
    • 1 个月
    • 2 个月
    • 3 个月
    • 6 个月
    • 1 年

    时长决定用户被计费的频率。

  5. 设置定价

    点击 添加订阅价格 配置价格:

    基础地区: 选择您的主要市场(通常是您的国家)

    价格: 设置订阅价格

    • 苹果会自动将其转换为其他货币
    • 选择苹果的价格等级
    • 考虑人们对产品的看法和市场价格

    配置价格

  6. 家庭共享(可选)

    决定是否启用家庭共享功能,允许最多6名家庭成员访问订阅。

    启用条件:

    • 内容适合家庭使用
    • 您希望增加价值提议
    • 您的商业模式支持它

    不启用条件:

    • 订阅仅限个人使用
    • 内容针对个人用户
    • 您希望最大化每用户收入
  7. 添加本地化

    在您的应用程序支持的所有语言中添加订阅显示信息:

    订阅显示名称: 客户端名称(例如,“Premium Monthly”)

    描述: 订阅所包含的简要描述

    • 保持简洁,重点在于好处
    • 提及关键功能
    • 突出价值提案

    添加本地化

  8. App Store 推广图片(选填)

    上传此订阅的推广图片(312x390像素):

    • 显示在 App Store 订阅页面
    • 应与您的应用设计保持一致
    • 包含订阅名称以提高清晰度
  9. 保存并提交

    点击 保存 以创建订阅。

    首次订阅:

    • 必须与新应用版本一起提交
    • 下一次 App Store 提交中包含
    • 无法独立提交

    续订服务:

    • 可以直接从订阅页面提交
    • 无需新版本
    • 首次订阅通过后可用

订阅状态

订阅状态

您的订阅将处于以下状态之一:

状态描述是否可测试
缺少元数据设置不完整是(沙盒)
准备提交已完成但未提交是(沙盒)
等待审查已提交到苹果是(沙盒)
正在审查苹果正在审查是(沙盒)
已通过可供购买
被拒绝需要修改是(沙盒)

在您的应用中使用

标题:在您的应用中使用

创建后,请在应用中使用产品 ID 引用订阅:

import { NativePurchases, PURCHASE_TYPE } from '@capgo/native-purchases';
// Fetch subscription products direct from StoreKit
const { products } = await NativePurchases.getProducts({
productIdentifiers: [
'com.yourcompany.yourapp.premium_monthly',
'com.yourcompany.yourapp.premium_annual',
],
productType: PURCHASE_TYPE.SUBS,
});
products.forEach((product) => {
console.log(`${product.title}: ${product.priceString}`);
console.log(`Duration: ${product.subscriptionPeriod}`);
console.log(`Description: ${product.description}`);
});
// Purchase a subscription (StoreKit 2 automatically handles intro pricing and offers)
try {
const transaction = await NativePurchases.purchaseProduct({
productIdentifier: 'com.yourcompany.yourapp.premium_monthly',
productType: PURCHASE_TYPE.SUBS,
});
console.log('Transaction ID:', transaction.transactionId);
// StoreKit receipts are included on iOS for server-side validation
await sendReceiptToBackend(transaction.receipt);
} catch (error) {
console.error('Purchase failed:', error);
}
// Check subscription status using the store's data
const { purchases } = await NativePurchases.getPurchases({
productType: PURCHASE_TYPE.SUBS,
});
const premium = purchases.find(
(purchase) => purchase.productIdentifier === 'com.yourcompany.yourapp.premium_monthly',
);
if (premium?.isActive) {
console.log('Expires:', premium.expirationDate);
console.log('Will renew:', premium.willCancel === false);
console.log('Store state:', premium.subscriptionState);
unlockPremiumFeatures();
} else {
showPaywall();
}

每月12个月的承诺计划

标题:每月12个月的承诺计划

如果您的App Store Connect订阅配置为每月计费计划,并且有12个月的承诺,StoreKit可以返回该产品的额外定价条款。使用这些条款来显示每月费用、总承诺价格和全承诺期限之前购买。

const yearlyProduct = products.find(
(product) => product.identifier === 'com.yourcompany.yourapp.premium_annual',
);
const monthlyCommitment = yearlyProduct?.pricingTerms?.find(
(term) => term.billingPlanType === 'monthly',
);
if (yearlyProduct && monthlyCommitment) {
console.log('Monthly charge:', monthlyCommitment.billingDisplayPrice);
console.log('Total commitment:', monthlyCommitment.commitmentInfo?.priceString);
await NativePurchases.purchaseProduct({
productIdentifier: yearlyProduct.identifier,
productType: PURCHASE_TYPE.SUBS,
billingPlanType: 'monthly',
});
}

查看完整的付费墙和权利流程,请参见 iOS每月承诺计费计划.

  • 每月计划: 简化入门,培养习惯
  • 年度计划: 更高的价值,高回报率,低流失率
  • 多个等级: 基本、Premium、Ultimate 等级适用于不同用户群
  • 竞争分析: 研究类似应用的定价
  • 保持一致的命名: company.app.tier_duration
  • 包含等级和持续时间在 ID 中: premium_monthly, ultimate_annual
  • 避免更改产品 ID(它们是永久的)
  • 为团队记录所有产品 ID

家庭共享

家庭共享
  • 为家庭导向的应用程序(游戏、教育、娱乐)启用
  • 考虑到收入的影响
  • 彻底测试共享行为
  • 在营销中传达共享能力

本地化

本地化
  • 将所有订阅名称和描述都翻译
  • 考虑区域价格差异
  • 测试在所有支持语言中显示
  • 使用适当的市场语言

促销图片

促销图片
  • 保持一致的视觉风格
  • 包含订阅名称和关键优势
  • 更新季节促销
  • 与应用程序的整体设计语言相匹配

常见订阅模式

常见订阅模式

单层(免费)

单层(免费)
Free App + Premium Subscription
- Basic: Free (limited features)
- Premium Monthly: $4.99
- Premium Annual: $39.99 (save 33%)

多层级 (优, 优良, 最佳)

标题:多层级 (优, 优良, 最佳)
- Basic Monthly: $4.99
- Premium Monthly: $9.99
- Ultimate Monthly: $19.99
- Basic Annual: $49.99
- Premium Annual: $99.99
- Ultimate Annual: $199.99

可消耗 + 订阅混合

标题:可消耗 + 订阅混合
- Credit packs (consumable)
- Monthly subscription (unlimited credits)
- Annual subscription (unlimited + bonus features)

订阅未在应用中加载:

  • 确认产品 ID 与订阅 ID 匹配(区分大小写)
  • 检查订阅是否属于订阅组
  • 确保 App Store Connect 的包名与应用的包名匹配
  • 等待 2-3 小时后创建产品

无法提交订阅:

  • 完成所有必填字段(名称、描述、价格)
  • 添加至少一个本地化
  • 验证银行/税务信息已批准
  • 检查首次订阅(需要应用版本)

家庭共享开关禁用:

  • 已启用(无法禁用)
  • 检查订阅详细信息
  • 联系 Apple 支持如果卡住

价格级别不可用:

  • 可能在某些地区受限制
  • 选择替代等级
  • 联系苹果询问价格问题

“无效产品ID”错误:

  • 必须以反向域名格式
  • 不能包含空格或特殊字符
  • 检查拼写错误
  • 验证所有产品的唯一性

下一步

下一步

有关更多详细信息,请参阅 苹果官方文档关于自动续订订阅.

继续从创建 iOS 自动续订订阅

标题:继续从创建 iOS 自动续订订阅

如果您正在使用 创建 iOS 自动续订订阅 为商店审批和发布做好准备,连接它 使用 @capgo/native-purchases 在使用 @capgo/native-purchases 中的原生能力 @capgo/capacitor-in-app-review 在 @capgo/capacitor-in-app-review 中的实现细节 使用 @capgo/capacitor-in-app-review 在使用 @capgo/capacitor-in-app-review 中的原生能力 @capgo/capacitor-native-market 在 @capgo/capacitor-native-market 中的实现细节,并 使用 @capgo/capacitor-native-market 在使用 @capgo/capacitor-native-market 中的原生能力