概述
概述轻松实现内购订阅。
核心功能
核心功能- Native in-app purchases and subscriptions with StoreKit 2 and Google Play Billing.
- Product metadata loaded directly from the stores, including localized titles and prices.
- iOS StoreKit pricing terms for monthly subscriptions with 12-month commitments.
- Purchase, restore, entitlement refresh, and native subscription management flows.
- App Transaction helpers for migration from older business models.
公开 API
Section titled “公开 API”| 方法 | 描述 |
|---|---|
restorePurchases | 恢复用户的前置购买并将其与任何使用相同的 appUserIDs 的用户关联起来。 |
getAppTransaction | 获取 App Transaction 信息,提供有关用户最初下载或购买应用的详细信息。 |
isEntitledToOldBusinessModel | 比较 App Transaction 中的原始应用版本与目标版本以确定用户是否有权从较早的商业模式中获得特征。 |
purchaseProduct | 启动本机购买流程。支持的iOS版本中,传递 billingPlanType: 'monthly' 以购买一个月的计费计划,12个月的承诺 |
getProducts | 获取与产品标识符相关的产品信息。支持的iOS版本中,订阅产品可以包括 pricingTerms. |
getProduct | 获取单个产品标识符的产品信息 |
isBillingSupported | 检查当前设备是否支持计费 |
getPluginVersion | 获取本机Capacitor插件版本 |
getPurchases | 获取所有用户的购买记录(包括应用内购买和订阅)。此方法查询当前用户的平台购买历史 |
manageSubscriptions | 打开平台的本机订阅管理页面。允许用户查看、修改或取消订阅 |
acknowledgePurchase | 手动确认/完成购买交易 |
consumePurchase | 在Android上消费应用内购买 |
addListener | 监听Apple的Transaction.updates传递的StoreKit交易更新。iOS中只触发在app启动时有未完成交易,之后的任何更新 |
addListener | 监听Apple的Transaction.updates传递的StoreKit交易验证失败。iOS中只触发验证结果未验证时 |
removeAllListeners | 移除所有已注册的监听器。 |
真实数据来源
标题:真实数据来源此参考资料是从 src/definitions.ts 在 capacitor-native-purchases.
继续阅读 @capgo/native-purchases
标题:继续阅读 @capgo/native-purchases如果您正在使用 @capgo/native-purchases 来规划付款和购买,连接它与 使用 @capgo/native-purchases 为使用@capgo/native-purchases的原生功能 Capgo Pricing 为Capgo Pricing中的产品工作流 支付系统 为支付系统中的实现细节 开始使用 为开始使用中的实现细节 营收指南 为营收指南中的实现细节