概述
概述简化内购。
核心功能
核心功能- 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
公共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中只触发一次应用启动,如果有未完成的交易,之后任何更新都触发。 |
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中的产品工作流 支付系统 为支付系统中的实现细节 开始使用 为开始使用中的实现细节, 和 营收指南 为营收指南中的实现细节