Skip to content

About

RevenueCat SDK for Android & Jetpack Compose, easy in-app purchases and subscriptions.

Topics

Resources

Contributing

Stars

567 stars

Watchers

11 watching

Forks

Latest commit

 

History

3,864 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

purchases-android

The RevenueCat SDK for Android. It wraps Google Play Billing and handles purchases, entitlements, and subscription status.

Maven Central version License: MIT

Docs · Install guide · SDK reference · Sample app · Changelog · Migration guide

Requirements

Requirement Minimum
Android 6.0 (API level 23)
Compile SDK API 35
Kotlin 2.1.0
Java source and target compatibility 8

Paywalls and Customer Center (purchases-ui) need Android 7.0 (API level 24) or later.

Installation

Add the SDK from Maven Central to your module's build.gradle.kts. Leave out purchases-ui if you don't show Paywalls or Customer Center; it needs Android 7.0 (API level 24).

implementation("com.revenuecat.purchases:purchases:<latest version>")
implementation("com.revenuecat.purchases:purchases-ui:<latest version>")

Replace <latest version> with the version on the Maven Central badge above.

Then, in AndroidManifest.xml, set the launchMode of the Activity that triggers purchases to standard or singleTop. Other modes can cancel the purchase if Google Play sends the user to another app, such as their banking app, to verify payment. See the launchMode step.

  • Version catalog: declare the same dependencies in gradle/libs.versions.toml. See the install guide.
  • Amazon Appstore or Galaxy Store: add the store module from the table below, then follow the other stores steps. Amazon builds configure with AmazonConfiguration.Builder; see Configure the SDK.
Package What it's for When you need it
purchases Purchases, entitlements, subscription status Always
purchases-ui Paywalls and Customer Center You show RevenueCat Paywalls or Customer Center. Needs Android 7.0 (API level 24)
purchases-store-amazon Amazon Appstore purchases You sell through the Amazon Appstore
purchases-store-galaxy Galaxy Store purchases You sell through the Galaxy Store
purchases-admob Tracks AdMob ad events in RevenueCat You show AdMob ads. Apps on the Google Mobile Ads Next-Gen SDK use purchases-admob-next-gen instead (Android 7.0, API level 24)

Quick start

Before you start, create a RevenueCat project, connect your store or start with the Test Store, and add an entitlement. See the Quickstart.

Configure Purchases once in your Application class with your public API key (the Test Store key while you test):

import android.app.Application
import com.revenuecat.purchases.LogLevel
import com.revenuecat.purchases.Purchases
import com.revenuecat.purchases.PurchasesConfiguration

class MainApplication: Application() {
    override fun onCreate() {
        super.onCreate()
        Purchases.logLevel = LogLevel.DEBUG
        Purchases.configure(PurchasesConfiguration.Builder(this, <public_google_api_key>).build())
    }
}

If you add MainApplication as shown above, set android:name=".MainApplication" on the <application> element in AndroidManifest.xml. If your app already has an Application subclass, call Purchases.configure in its onCreate() instead.

Check whether the user has an active entitlement before you show a paywall:

import com.revenuecat.purchases.getCustomerInfoWith

Purchases.sharedInstance.getCustomerInfoWith(
    onError = { error -> /* Optional error handling */ },
    onSuccess = { customerInfo ->
        if (customerInfo.entitlements[<my_entitlement_identifier>]?.isActive == true) {
            // Grant user "pro" access
        }
    }
)

What's included

  • Paywalls: build single-screen or multi-step paywalls in the dashboard and change them without an app update.
  • Customer Center: a self-service screen where users cancel subscriptions, restore purchases, and contact your support team.
  • Placements: serve a different Offering at each paywall location in your app.
  • Test Store: test purchases before you set up Google Play.
  • In-app currency: read the current Customer's in-app currency balances.
  • Redemption Links: unlock a web purchase in your app from a deep link.
  • Your own purchase code: set purchasesAreCompletedBy to keep completing purchases with your existing billing code.
  • Offline entitlements: the SDK can grant entitlements for new subscription purchases while RevenueCat's servers are down. This feature is unavailable in Test Store and when your app completes purchases itself.
  • Trusted Entitlements: the SDK checks a signature on entitlement data so your app can detect tampered responses. It runs in informational mode by default: it reports the result and doesn't block access.
  • Amazon Appstore and Galaxy Store: sell outside Google Play with the purchases-store-amazon or purchases-store-galaxy module.
  • Ad Monetization: report ad impressions, clicks, and revenue next to subscription data. The AdMob adapter tracks AdMob events automatically (Kotlin only).

Documentation

Using an AI coding agent

Your agent's training data is likely older than the current version of this SDK. Point it at current sources:

  • llms.txt: an index of the docs. Add .md to any docs URL for a Markdown version.
  • RevenueCat MCP server: lets your agent read and change your RevenueCat project configuration.
  • AI Toolkit: installs RevenueCat skills and the MCP server in one step.
  • Releases: check the latest version before adding the dependency.

Sample apps

  • MagicWeatherCompose: a Jetpack Compose app that configures the SDK for Google Play or the Amazon Appstore, builds a custom paywall from Offerings, checks subscription status, restores purchases, and logs users in.

Getting help

Contributing

This repository is published from the main branch and release tags of RevenueCat's internal development repository. Issues are tracked here. Pull requests are welcome: a maintainer reviews them here and brings accepted changes into the internal repository, so they can't be merged directly.

See the contributing guide.

License

MIT. See LICENSE.

About

RevenueCat SDK for Android & Jetpack Compose, easy in-app purchases and subscriptions.

Topics

Resources

Contributing

Stars

567 stars

Watchers

11 watching

Forks

Releases

Used by

Contributors

Languages