跳过内容

@capgo/native-purchases

内购变得简单。

概览

概览

轻松实现内购和订阅

核心功能

核心功能
  • 使用 StoreKit 2 和 Google Play Billing 实现原生内购和订阅
  • 从商店直接加载产品元数据,包括本地化标题和价格
  • 适用于 iOS 的 StoreKit 月度订阅定价条款,12 个月的承诺
  • 购买、恢复、刷新权利和原生订阅管理流程
  • App 交易助手,用于从旧的商业模型迁移

公开 API

公开 API
{"targetLanguage":"Simplified Chinese","protectedTokens":["Cloudflare","Capacitor","GitHub","Capgo","code","API","SDK","CLI","npm","bun"],"texts":["Method","Description","Restores a user’s previous and links their appUserIDs to any user’s also using those .","Gets the App Transaction information, which provides details about when the user originally downloaded or purchased the app.","Compares the original app version from the App Transaction against a target version to determine if the user is entitled to features from an earlier business model.","Starts the native purchase flow. On supported iOS versions, pass","to purchase a monthly billing plan with a 12-month commitment.","Gets product info associated with product identifiers. On supported iOS versions, subscription products can include","Gets the product info for a single product identifier.","Check if billing is supported for the current device.","Get the native __CAPGO_KEEP_0__ plugin version.","Gets all the user’s purchases (both in-app purchases and subscriptions). This method queries the platform’s purchase history for the current user."],methods
restorePurchasesmethod
getAppTransactiondescription
isEntitledToOldBusinessModel恢复用户的历史记录并将其与使用相同的 appUserIDs 的任何用户关联起来。
purchaseProduct获取应用程序交易信息,提供有关用户最初下载或购买应用程序的详细信息。 billingPlanType: 'monthly' 通过比较应用程序交易中的原始应用程序版本与目标版本来确定用户是否有权从早期商业模式中获得特征。
getProducts启动本机购买流程。支持的 iOS 版本中,请传递 pricingTerms.
getProduct以 12 个月的承诺购买一个月的计费计划。
isBillingSupported获取与产品标识符相关的产品信息。支持的 iOS 版本中,订阅产品可以包括
getPluginVersionGet the native Capacitor plugin version.
getPurchases检查当前设备是否支持计费。
manageSubscriptions打开平台的原生订阅管理页面。这使用户可以查看、修改或取消订阅。
acknowledgePurchase手动确认/完成购买交易。
consumePurchase在 Android 上消费应用内购买。
addListener监听 Apple 的 Transaction.updates 发送的 StoreKit 交易更新。启动应用时如果有未完成的交易,且之后有任何更新时触发。iOS only。
addListener监听 Apple 的 Transaction.updates 发送的 StoreKit 交易验证失败。验证结果未验证时触发。iOS only。
removeAllListeners移除所有注册的监听器。

真实数据来源

标题:真实数据来源

此参考资料是从 src/definitions.tscapacitor-native-purchases.