AppPurchase
Types
Link copied to clipboard
enum PurchaseType
Enum representing the type of purchase for ad-disabling purposes.
Link copied to clipboard
Subscription replacement modes for upgrade/downgrade.
Link copied to clipboard
interface SubscriptionVerificationListener
Listener for subscription verification results.
Properties
Functions
Link copied to clipboard
Whether every product passed to initBilling has loaded details.
Link copied to clipboard
open fun changeSubscription(activity: Activity, currentSubsId: String, newSubsId: String, replacementMode: AppPurchase.SubscriptionReplacementMode): String
Upgrades or downgrades from a specific subscription.
Link copied to clipboard
Link copied to clipboard
Consumes a purchased product, allowing it to be purchased again.
Link copied to clipboard
Downgrades a subscription to a lower tier.
Link copied to clipboard
Formats a micros price with the device's locale conventions.
Link copied to clipboard
Gets the type of purchase that is disabling ads.
Link copied to clipboard
Gets all active subscriptions with their states.
Link copied to clipboard
Returns the "base" subscription offer — the one without trial or intro pricing phases.
Link copied to clipboard
Returns the cheapest currently-valid offer for a one-time product — the discount to show when several are live.
Link copied to clipboard
Returns the offer with the lowest recurring cost per month, comparing plans of different cadences on equal terms.
Link copied to clipboard
ISO-8601 base billing cycle (e.g.
Link copied to clipboard
Returns the offer that costs the user least for their first billing cycle — a free trial beats an introductory price, which beats full price.
Link copied to clipboard
Returns the ISO-4217 currency code for a product's price.
Link copied to clipboard
Recurring price of the base offer normalized to one average month, formatted in the device locale (e.g.
Link copied to clipboard
ISO-8601 trial duration (e.g.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Number of billing cycles the introductory price applies for.
Link copied to clipboard
ISO-8601 duration of one introductory cycle (e.g.
Link copied to clipboard
Formatted introductory price (the discounted, finite-recurring phase) across all offers of a subscription.
Link copied to clipboard
Returns the first offer on this subscription that has an introductory (discounted, finite-recurring) pricing phase, or
null if none does.Link copied to clipboard
Looks up a subscription offer by its Play Console base plan id.
Link copied to clipboard
Looks up a subscription offer by its Play Console offer id.
Link copied to clipboard
Returns the first offer carrying the given Play Console offer tag.
Link copied to clipboard
Link copied to clipboard
Looks up a one-time product offer by its Play Console offer id.
Link copied to clipboard
Returns every offer attached to a one-time (INAPP) product, mapped to a typed OneTimeOfferInfo.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Recurring price of the base offer normalized to one average month, in micros.
Link copied to clipboard
Returns the full pricing-phase list of the resolved base offer — useful for paywalls that want to render every phase (trial → intro → recurring).
Link copied to clipboard
Returns the formatted base (post-trial / post-intro) price for a subscription.
Link copied to clipboard
Raw numeric price (currency unit, not micros) — useful for analytics events that expect a
double amount.Link copied to clipboard
Localized Play Console product description.
Link copied to clipboard
Escape hatch: returns the raw ProductDetails for callers that need fields not surfaced by the typed helpers (e.g.
Link copied to clipboard
Clean Play Console product name (without the app-name suffix).
Link copied to clipboard
Play Console title (includes the app name suffix Play appends, e.g.
Link copied to clipboard
Gets the category of a purchased product.
Link copied to clipboard
Gets the PurchaseItem configuration for a product ID.
Link copied to clipboard
Whole-percent saving of
comparedProductId against baseProductId, normalized to a common monthly cadence.Link copied to clipboard
Gets the subscription result for a specific product.
Link copied to clipboard
Gets the subscription expiry time in milliseconds.
Link copied to clipboard
Gets the subscription expiry time as a formatted string.
Gets the subscription expiry time as a formatted string with custom pattern.
Link copied to clipboard
Gets the remaining days until subscription expiry.
Link copied to clipboard
Gets the subscription state for a specific subscription.
Link copied to clipboard
Returns the first offer on this subscription that contains a free-trial phase, or
null if no offer has a trial.Link copied to clipboard
Returns the products Play declined to return details for during the most recent query of each type.
Link copied to clipboard
Link copied to clipboard
Whether any offer on this subscription includes a free-trial phase (
priceAmountMicros == 0 with FINITE_RECURRING).Link copied to clipboard
Whether any offer on this subscription has an introductory price phase.
Link copied to clipboard
Checks if user has a "Lifetime Premium" purchase specifically.
Link copied to clipboard
Checks if user has a lifetime premium purchase.
Checks if a specific product has been purchased and is currently owned.
Link copied to clipboard
Whether any subscription has a plan change the user started but has not paid for yet.
Link copied to clipboard
Checks if user has a "Remove Ads" purchase specifically.
Link copied to clipboard
Checks if any subscription is cancelled but still has access.
Link copied to clipboard
Whether any active subscription is in account hold — Play could not charge the user and has suspended the subscription.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Whether this user can currently start a free trial on this product.
Link copied to clipboard
Whether this user can currently claim an introductory price on this product.
Link copied to clipboard
Whether Play returned details for the given product id.
Link copied to clipboard
Checks if a specific product is currently owned (purchased and not consumed).
Link copied to clipboard
Link copied to clipboard
Checks if user has an active subscription (including cancelled but not expired).
Checks if user has a specific active subscription.
Link copied to clipboard
Checks if a subscription has expired based on verified expiry time.
Link copied to clipboard
Launches the purchase flow for the exact one-time offer described by
offer.Launches the purchase flow for a product, letting the library pick the offer (the configured trial offer if any, otherwise Play's last offer).
Launches the purchase flow for one specific offer of a product.
Link copied to clipboard
Link copied to clipboard
Refreshes and retrieves all current purchases from Google Play.
Refreshes and retrieves current purchases for a specific product type.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Enables debug behaviour: registers the legacy test product in initBilling and shows the dev purchase bottom sheet instead of the real billing flow.
Link copied to clipboard
Link copied to clipboard
Sets an obfuscated identifier for the user's in-app account, attached to every subsequent billing flow.
Link copied to clipboard
Sets an obfuscated identifier for the user's in-app profile, attached to every subsequent billing flow.
Link copied to clipboard
Declares whether the prices shown to this user were personalized using automated decision-making.
Link copied to clipboard
Link copied to clipboard
Registers a listener for product-details query results, including the products Play could not return.
Link copied to clipboard
Link copied to clipboard
Sets a listener to receive purchase history events.
Link copied to clipboard
Link copied to clipboard
Sets a callback for server-side subscription verification.
Link copied to clipboard
Link copied to clipboard
Checks if ads should be disabled based on any purchase type.
Link copied to clipboard
Shows Google Play's in-app messages for the current user, if any apply.
Link copied to clipboard
Subscribes to the exact offer described by
offer.Subscribes to a product, letting the library pick the offer (the offer whose id matches trialId if configured, otherwise Play's last offer).
Subscribes to one specific offer of a subscription product.
Link copied to clipboard
Link copied to clipboard
open fun updateSubscription(activity: Activity, newSubsId: String, oldPurchaseToken: String, replacementMode: AppPurchase.SubscriptionReplacementMode): String
Upgrades or downgrades a subscription.
open fun updateSubscription(activity: Activity, newSubsId: String, @Nullable offerToken: String, oldPurchaseToken: String, replacementMode: AppPurchase.SubscriptionReplacementMode): String
Upgrades or downgrades a subscription onto one specific offer of the new product.
Link copied to clipboard
Upgrades a subscription to a higher tier.
Link copied to clipboard
Verifies all active subscriptions with your backend server.
Link copied to clipboard
Link copied to clipboard
open fun verifySubscription(subscriptionId: String, listener: AppPurchase.SubscriptionVerificationListener)
Verifies a subscription with your backend server to get the expiry date.
Link copied to clipboard
Checks if all subscriptions will auto-renew.