Skip to content

@capgo/native-purchases

In-app Subscriptions Made Easy.

@capgo/native-purchases wraps StoreKit 2 and Google Play Billing with one Capacitor API for subscriptions, consumables, and restore flows. Load product metadata from the stores, purchase in app, and refresh entitlements without maintaining separate native bridges.

Choose this plugin when you want first party billing without a third party subscription SDK.

Exact Android offers

Pass offerToken from the same getProducts() result you displayed so purchaseProduct() charges that offer. See Android subscription offers.

Optional billing period

Product.subscriptionPeriod is optional. Android omits it on prepaid offers. Use product.subscriptionPeriod?.unit.

Installment cycles

Android installment plans can include subscriptionBillingCycles from Play’s installment commitment payment count.

These Android offer and product details are documented for capacitor-native-purchases#245.

PlatformBilling stack
iOSStoreKit 2
AndroidGoogle Play Billing 7+
  • 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.
  • Android offer tokens, optional subscription periods, and installment billing cycle counts. See Android subscription offers.
  • 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.
MethodDescription
restorePurchasesRestores a user’s previous and links their appUserIDs to any user’s also using those .
getAppTransactionGets the App Transaction information, which provides details about when the user originally downloaded or purchased the app.
isEntitledToOldBusinessModelCompares 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.
purchaseProductStarts the native purchase flow. On Android, pass offerToken to charge one exact offer from getProducts(), or planIdentifier for the first offer on that base plan. On supported iOS versions, pass billingPlanType: 'monthly' to purchase a monthly billing plan with a 12-month commitment.
getProductsGets product info associated with product identifiers. On supported iOS versions, subscription products can include pricingTerms. On Android, subscription products may include subscriptionPeriod and subscriptionBillingCycles when Play exposes them.
getProductGets the product info for a single product identifier.
isBillingSupportedCheck if billing is supported for the current device.
getPluginVersionGet the native Capacitor plugin version.
getPurchasesGets all the user’s purchases (both in-app purchases and subscriptions). This method queries the platform’s purchase history for the current user.
manageSubscriptionsOpens the platform’s native subscription management page. This allows users to view, modify, or cancel their subscriptions.
acknowledgePurchaseManually acknowledge/finish a purchase transaction.
consumePurchaseConsume an in-app purchase on Android.
addListenerListen for StoreKit transaction updates delivered by Apple’s Transaction.updates. Fires on app launch if there are unfinished transactions, and for any updates afterward. iOS only.
addListenerListen for StoreKit transaction verification failures delivered by Apple’s Transaction.updates. Fires when the verification result is unverified. iOS only.
removeAllListenersRemove all registered listeners.

This reference is synced from src/definitions.ts in capacitor-native-purchases.

If you are using @capgo/native-purchases to plan payments and purchases, connect it with Using @capgo/native-purchases for the native capability in Using @capgo/native-purchases, Capgo Pricing for the product workflow in Capgo Pricing, Payment system for the implementation detail in Payment system, Getting Started for the implementation detail in Getting Started, and Revenue Playbook for the implementation detail in Revenue Playbook.