RevenueCat's Unity SDK wraps StoreKit and Google Play Billing to handle purchases and subscription status. The UI package adds Paywalls and Customer Center.
Docs · Install guide · Sample app · Changelog · Migration guide
| Requirement | Minimum |
|---|---|
| Unity | 2022.3.33f1 |
| iOS | 13.0 |
| Android Target API Level | 35 |
Paywalls and Customer Center need iOS 15 or later and Android 7.0 (API level 24) or later. The SDK doesn't run in the Unity Editor, so build and run your app on a device or simulator to test it.
Install the core package from OpenUPM with the OpenUPM CLI:
openupm add com.revenuecat.purchases-unityIf you show Paywalls or Customer Center, add the UI package next: openupm add com.revenuecat.purchases-ui-unity.
- Without the CLI: in Project Settings > Package Manager, add a scoped registry with URL
https://package.openupm.comand scopescom.openupm,com.revenuecat.purchases-unity, and (for the UI package)com.revenuecat.purchases-ui-unity, then install from My Registries. See the install guide. .unitypackage: importPurchases.unitypackagefrom the latest release, plusPurchasesUI.unitypackagefor Paywalls or Customer Center.
RevenueCat uses a dependency manager for its native iOS and Android libraries.
- OpenUPM installs Unity’s External Dependency Manager automatically.
- If installing via
.unitypackage, Unity’s manager will be installed on first import if you open the project in the Unity Editor and the project has no dependency manager. If CI performs the first import in batch mode, add the manager to your project beforehand from Window > Package Manager > Unity Registry.
If your project already uses Google’s EDM4U, you can keep using it. EDM4U is deprecated. To switch to Unity’s manager and avoid having both installed, follow the v10 migration guide.
Starting with version 11, RevenueCat's iOS dependencies are no longer published to CocoaPods, so the External Dependency Manager must add them with Swift Package Manager. Check that Swift Package Manager Integration is enabled in the iOS Resolver settings: Edit > Project Settings > External Dependency Manager > iOS Resolver with Unity's External Dependency Manager (2.1 or later), or Assets > External Dependency Manager > iOS Resolver > Settings with EDM4U (1.2.189 or later). Other CocoaPods dependencies in your project keep working. If your project installs RevenueCat through CocoaPods, migrate to Swift Package Manager before you upgrade to version 11.
On Android, set Player Settings > Other Settings > Target API Level to 35 or higher. Lower values fail the Gradle build.
| Package | What it's for | When you need it |
|---|---|---|
com.revenuecat.purchases-unity |
Purchases, entitlements, subscription status | Always |
com.revenuecat.purchases-ui-unity |
Paywalls and Customer Center | You show RevenueCat Paywalls or Customer Center |
com.revenuecat.purchases-admob-unity |
Tracks AdMob ad events in RevenueCat | You show AdMob ads. Import PurchasesAdMob.unitypackage (not on OpenUPM). Needs the Google Mobile Ads Unity plugin and iOS 15 or later |
Before you start, create a RevenueCat project, connect your store or start with the Test Store, and add an entitlement. See the Quickstart.
Add the Purchases component to one GameObject and keep it as a singleton. Enter your public API keys in the Inspector (the Test Store key while you test). The component configures the SDK when it starts.
To configure from code, check Use Runtime Setup on the Purchases component. Attach this PurchasesSetup.cs script to the same GameObject and replace the placeholder with the public API key for the store you're testing. The DefaultExecutionOrder attribute makes this script's Start() run after Purchases.Start() initializes the SDK wrapper.
using UnityEngine;
[DefaultExecutionOrder(1000)]
public class PurchasesSetup : MonoBehaviour
{
private void Start()
{
var builder = Purchases.PurchasesConfiguration.Builder.Init(<public_api_key>);
builder.SetAppUserId(<app_user_id>);
GetComponent<Purchases>().Configure(builder.Build());
}
}Replace <app_user_id> with the signed-in user’s ID from your account system. For anonymous users, omit the SetAppUserId line and RevenueCat will generate an ID.
After configuration, check whether the user has an active entitlement before showing a paywall. Replace <my_entitlement_identifier> with your entitlement identifier.
var purchases = GetComponent<Purchases>();
purchases.GetCustomerInfo((customerInfo, error) =>
{
if (customerInfo.Entitlements.Active.ContainsKey(<my_entitlement_identifier>)) {
// Unlock that great "pro" content
}
});- Paywalls: build single-screen or multi-step paywalls in the dashboard and change them without an app update. Needs the UI package.
- Customer Center: a self-service screen where users cancel subscriptions, restore purchases, and, on iOS, request refunds or change plans. Needs the UI package.
- Placements: serve a different Offering at each paywall location in your app.
- Test Store: test purchases before you set up App Store Connect or Google Play Console.
- 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.
- iOS subscription offers: promotional offers, the offer code redemption sheet, and win-back offers.
- Your own purchase code: set
purchasesAreCompletedBytoMyAppandstoreKitVersionto the StoreKit version your code uses, to keep completing purchases with your own code. To run RevenueCat alongside Unity IAP 5 or later, see Unity IAP side by side. - Offline entitlements: the SDK grants entitlements for new subscription purchases while RevenueCat's servers are down. It's unavailable when your app completes purchases itself.
- Trusted Entitlements: the SDK checks a signature on entitlement data and reports the result, so your app can detect tampered responses. Verification is on by default in informational mode and doesn't block access on its own.
- Amazon Appstore: set Use Amazon and your Amazon API key on the
Purchasescomponent. Unity IAP 5 dropped Amazon support, so let RevenueCat complete Amazon purchases. - Ad Monetization: report ad impressions, clicks, and revenue next to subscription data (iOS 15 or later). The AdMob adapter tracks AdMob events automatically.
- Install guide: OpenUPM and
.unitypackagesteps, AndroidlaunchModeand ProGuard rules, and running alongside Unity IAP. - Configure the SDK: API keys, debug logs, and switching between Test Store and real stores.
- Displaying paywalls: present a paywall with
PaywallsPresenteror thePaywallsBehaviourcomponent. - Customer Center on Unity: install the UI package and present Customer Center.
- Testing purchases: Test Store and sandbox testing.
- Migration guide: upgrading to version 11 (Swift Package Manager required on iOS). If you're upgrading from version 9, start with the version 10 guide (Target API Level 35, Unity's External Dependency Manager, API changes).
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
.mdto 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.
- Subtester: a Unity 6 test app with a screen for each SDK area, including login, Offerings and placements, purchases,
CustomerInfo, Paywalls, Customer attributes, and AdMob ads. It loads the packages from this repo's folders, so open it from a clone.
- Bugs: open an issue in this repo.
- Account or configuration questions: RevenueCat Support.
- Discussion: RevenueCat Community.
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.
MIT. See LICENSE.