Rc Understanding Revenuecat

RevenueCat/ai-toolkit/revenuecat-play-billing/skills/rc-understanding-revenuecat

作者 RevenueCatccfc038185ec457b2ac9077f3bbf1ba947a44dbbApache-2.0; see LICENSE收录于 2026年10月9日更新于 2026年10月9日

Use this skill to orient an agent to the RevenueCat Android SDK (10.x) architecture. Covers how RevenueCat reorganizes BillingClient, Google Play Developer API, and RTDN into a single SDK, and how Products, Packages, Offerings, Entitlements, and CustomerInfo connect.

AI 生成的概览

帮助智能体理解 RevenueCat Android SDK 10.x 架构,并引导至后续 RevenueCat 技能。

功能
该技能仅包含说明,讲解 RevenueCat 如何将 BillingClient、Google Play Developer API 和实时开发者通知整合为一个 SDK 与后端。它定义 Product、Package、Offering、Entitlement 和 CustomerInfo 等核心概念,并给出获取 offerings 与 customer info 的常见读取方式。它还将常见用户目标映射到具体的后续 RevenueCat 技能,并提供路由前的检查清单。
适用场景
在编写 RevenueCat 代码之前使用;适合刚接触 RevenueCat 或从原生 Play Billing 迁移时,不确定某个概念对应哪个后台对象时,或需要决定调用哪个后续技能时。
运行要求
无需脚本或特殊工具,仅为说明性内容。假定读者了解 Android 与 Google Play Billing 概念,并涉及 RevenueCat Android SDK 10.x。

Understanding RevenueCat

Phase 0: Intent

Use this skill before writing any RevenueCat code. It gives you the vocabulary and mental model you need so that downstream skills (setup, configuration, purchase flow, entitlements) make sense.

Start here if any of these apply:

  • You are new to RevenueCat or coming from a raw Play Billing integration.
  • You are unsure which concept maps to which dashboard object.
  • You need to decide which downstream skill to invoke for a specific user goal.

Skip this skill if you already know the difference between an Offering, a Package, a Product, and an Entitlement, and you already know that Purchases.sharedInstance is the single entry point.

Phase 1: Orient

Raw Android in-app purchases require three separate systems. RevenueCat folds all three into one SDK plus one dashboard.

Raw Google Play stackRevenueCat replacementWhere it lives
BillingClient on the clientPurchases SDKYour Android app
Google Play Developer API on your serverRevenueCat backendRevenueCat managed
Real Time Developer Notifications via Cloud Pub/SubRevenueCat webhooksRevenueCat managed, delivered to your server

The call path is:

text
Your App  -> Purchases SDK  -> RevenueCat Backend  -> Google Play Developer API  -> Google Play

Your app talks to the Purchases SDK. The SDK talks to Google Play for the purchase UI and to the RevenueCat backend for verification and entitlement storage. Your server side code talks to the RevenueCat backend, not to Google Play directly.

One consequence: RevenueCat sits in the purchase verification path. After a user completes a purchase, the SDK posts the token to RevenueCat before your app sees confirmation. You trade a network round trip for not having to build server side verification yourself.

The four concepts you must know

ConceptWhat it isWhere you define it
ProductA subscription, base plan, or one time purchaseGoogle Play Console
PackageA Product wrapped with a type label (Monthly, Annual, Lifetime, custom). The unit your paywall displaysRevenueCat dashboard
OfferingA group of Packages. One Offering is marked Current and returned by offerings.currentRevenueCat dashboard
EntitlementA logical access level your app checks, such as "pro_access". Products are attached to EntitlementsRevenueCat dashboard

CustomerInfo is the runtime snapshot of the user's purchase history and active Entitlements, computed and cached by RevenueCat.

The only two reads you need most of the time

kotlin
val offerings = Purchases.sharedInstance.awaitOfferings()val monthly = offerings.current?.monthly
kotlin
val customerInfo = Purchases.sharedInstance.awaitCustomerInfo()val hasPro = customerInfo.entitlements["pro_access"]?.isActive == true

isActive already resolves the seven Play subscription states (ACTIVE, IN_GRACE_PERIOD, ON_HOLD, PAUSED, CANCELED, EXPIRED, PENDING) on the server side. You do not reimplement that logic on the client.

The singleton

Purchases.sharedInstance is the single entry point. You configure it once at app startup:

kotlin
Purchases.configure(    PurchasesConfiguration.Builder(context, "your_api_key")        .appUserID("optional_user_id")        .build())

Unlike BillingClient, the singleton does not require you to manage connection state. It reconnects and queues calls for you.

What RevenueCat does not replace

  • Google Play Console. You still create products, base plans, and offers there.
  • Your app UI. You still build the paywall and display prices. RevenueCat supplies the data.
  • Your authentication system. You bring your own user IDs and pass them to the SDK.

The tradeoff

You offload verification complexity and take on a dependency. If the RevenueCat backend has an outage, purchase verification is affected. Two mitigations exist and they are different:

FeatureWhat it doesWhen it kicks in
Disk cache of CustomerInfoReturns the last known server state for entitlement checksAutomatic, always on
Offline EntitlementsComputes entitlements on the device from local Play Store purchasesOnly when you explicitly configure it

Neither is a full substitute for a reachable backend. Use both where they apply.

Phase 2: Map the user goal to a downstream skill

Once you have the model above, pick the next skill based on what the user actually wants to do.

User goalNext skill
Install the SDK, wire up Gradle, add permissions, configure the Play Console productrc-setup
Call Purchases.configure, pass an appUserID, set log level, attach attributesrc-configuring-the-sdk
Fetch Offerings, show a paywall, call purchase, handle the resultrc-purchase-flow
Check customerInfo.entitlements["..."]?.isActive, gate features, listen for updatesrevenuecat/entitlements-and-customerinfo
Identify, alias, or log out a userrevenuecat/user-identity
Handle restore purchases, cross device, promo codesrevenuecat/restore-and-recovery
Receive server side events from RevenueCatrc-webhooks
Debug a specific purchase, receipt, or entitlement in productionrevenuecat/debugging

If the user's goal does not match any row, stay here and keep clarifying intent before routing.

Phase 3: Sanity check

Before you leave this skill and route to a downstream one, confirm out loud:

  1. You can name which of the three raw pillars (client billing, server Play Developer API, RTDN) the user's question touches.
  2. You can state whether the user is asking about a Product, a Package, an Offering, or an Entitlement. These are not interchangeable.
  3. You know whether the user needs Offerings (what to sell) or CustomerInfo (what the user already owns). Most confusion comes from mixing these two.
  4. You have picked exactly one downstream skill to invoke next, or you have a concrete clarifying question.

If any of the four fail, reread Phase 1 or the chapter before proceeding.

References

来源与署名

来源:RevenueCat/ai-toolkit位于revenuecat-play-billing/skills/rc-understanding-revenuecat提交ccfc038

许可证: Apache-2.0; see LICENSE

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架