Skip to main content
skill CX Codex

rc-subscriptions — Claude Code skill: what it does, how to install

Guides AI coding agents through RevenueCat's Android subscription model and Google Play hierarchy mapping. Helps structure paywalls and handle purchases.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add RevenueCat/ai-toolkit --skill rc-subscriptions -a claude-code
Open on GitHub

What rc-subscriptions does

This skill teaches coding agents how to bridge Google Play's three-tier subscription structure (Subscription, Base Plan, and Offer) into RevenueCat's Android object model. It guides the model through classes like Offering, Package, and SubscriptionOption, showing how to fetch catalogs with awaitOfferings() and initiate purchases using PurchaseParams.

It details offer selection logic and package iteration patterns. When passing a Package, defaultOption picks the longest trial or lowest initial cost while filtering out rc-ignore-offer tags. For win-back promotions, the skill demonstrates searching subscriptionOptions by tag with a fallback to defaultOption. It also covers prepaid plans requiring pendingTransactionsForPrepaidPlansEnabled(true).

Google Play handles trial eligibility checks, meaning ineligible trial options simply do not show up in the SDK results. After a transaction completes, access verification relies on customerInfo.entitlements rather than raw subscription IDs.

What it helps with

  • map Google Play subscription tiers to RevenueCat objects on Android
  • configure paywalls using offerings.current or segment experiments
  • target win-back or promotional offers via subscriptionOptions tags
  • extract trial durations and formatted pricing from pricingPhases
  • enable pending transactions for prepaid Google Play subscription plans

Example prompts for the agent

  • Show me how to fetch the current Offering and start a purchase for the monthly package in Kotlin.
  • Write RevenueCat Android code to pick a win-back offer by tag with a fallback to defaultOption.
  • How do I extract the trial period length and price from PricingPhase?

How to install rc-subscriptions

1Skills CLI (Vercel)

npx skills add RevenueCat/ai-toolkit --skill rc-subscriptions -a claude-code

2Manually: put the files in place

~/.claude/skills/rc-subscriptions/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/rc-subscriptions/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about rc-subscriptions

How do I install rc-subscriptions in Claude Code?

Run this command in your terminal: npx skills add RevenueCat/ai-toolkit --skill rc-subscriptions -a claude-code.

What does the rc-subscriptions skill do?

It provides architecture guidance and Kotlin patterns for Android subscriptions in RevenueCat. The skill teaches agents how to map Google Play plans, read paywalls, and verify entitlements.

How does the skill handle trial eligibility?

Trial eligibility is evaluated by Google Play rather than the SDK. If a user already consumed a trial, Google Play omits that option, so defaultOption automatically falls back to the base plan.

Source text

SKILL.md · MIT
---
name: rc-subscriptions
description: Use this skill when modeling subscriptions through RevenueCat's object model on Android. Covers Offerings, Packages, StoreProduct, SubscriptionOption, PricingPhase, and how they map to Google Play's Subscription, Base Plan, and Offer hierarchy.
license: Apache-2.0; see LICENSE
metadata:
  author: RevenueCat
  source: revenuecat-handbook chapter 4
  keywords:
  - android
  - revenuecat
  - subscriptions
  - offerings
  - packages
  - subscription-options
  - pricing-phase
---

# Subscriptions on Android with RevenueCat

Google Play exposes subscriptions through a three tier hierarchy: Subscription, Base Plan, and Offer. RevenueCat wraps that hierarchy in a flatter model you configure from the dashboard: Offerings, Packages, and SubscriptionOptions. You fetch an Offering, pick a Package, and in most flows let the SDK choose the right SubscriptionOption for you.

## Phase 1: Understand

The mapping from Google Play to RevenueCat:

| Google Play | RevenueCat |
|---|---|
| Subscription (product ID) | `StoreProduct` |
| Base Plan | `SubscriptionOption` (base plan) |
| Offer | `SubscriptionOption` (offer) |
| Group of base plans grouped in dashboard | `Package` inside an `Offering` |

Key types you will touch:

- `Offering`: a dashboard configured group of `Package` objects. `offerings.current` is the one you show by default.
- `Package`: a purchasable slot (monthly, annual, weekly, custom). Exposes a `product: StoreProduct`.
- `StoreProduct`: the Google Play subscription product. Has `subscriptionOptions: List<SubscriptionOption>?` and a `defaultOption`.
- `SubscriptionOption`: either a base plan or an offer. Has `pricingPhases`, `tags`, and an `id`.
- `PricingPhase`: one billing segment (intro trial, intro price, or recurring). Has `billingPeriod`, `price`, `offerPaymentMode`, and `recurrenceMode`.

See the [Subscriptions chapter on revenuecat.com](https://www.revenuecat.com/guides/revenuecat-android-sdk/subscriptions-with-revenuecat) for the object model diagram showing the full Offerings hierarchy alongside the CustomerInfo hierarchy used for entitlement checks.

## Phase 2: Plan

Before you write code, map your paywall to the object model. Answer these three questions.

### 2.1 Which Offering drives the paywall?

- Default paywall: use `offerings.current`. This is the Offering marked current in the dashboard and is the standard choice.
- Experiment or segment specific paywall: fetch `offerings.all["experiment-a"]`. You keep the dashboard in charge of which products appear, so no app update ships when the catalog changes.

### 2.2 Which Packages do you show?

Two access patterns, pick the one that matches your layout:

| Pattern | API | When to use |
|---|---|---|
| Named slots | `offering.monthly`, `offering.annual`, `offering.weekly` | Fixed paywall with known durations |
| Iteration | `offering.availablePackages` | Dynamic layout, unknown durations, or custom package types |

Standard `PackageType` values: `MONTHLY`, `ANNUAL`, `WEEKLY`, `TWO_MONTH`, `THREE_MONTH`, `SIX_MONTH`, `LIFETIME`. Anything else is `PackageType.CUSTOM`.

### 2.3 Does the paywall need a specific offer, or is the default fine?

| Situation | What to pass to `PurchaseParams` |
|---|---|
| Standard paywall, user gets best eligible offer automatically | `Package` |
| You need a specific offer (win back, promo, tag selected) | `SubscriptionOption` |

The SDK's `defaultOption` logic:

1. Filters out options tagged `"rc-ignore-offer"` or `"rc-customer-center"`.
2. Picks the option with the longest free trial or the cheapest first phase.
3. Falls back to the base plan if no offer qualifies.

Trial eligibility is not filtered by the SDK. Google Play only returns offers the user is eligible for, so if a user already consumed a free trial, that option simply will not appear in `subscriptionOptions` and the base plan becomes the default.

## Phase 3: Execute

### 3.1 Pull Offerings and pick a Package

```kotlin
val offerings = Purchases.sharedInstance.awaitOfferings()
val offering = offerings.current ?: return
val monthly = offering.monthly ?: return
val product = monthly.product
val price = product.price.formatted
val period = product.period?.iso8601 // "P1M", "P1Y", null for one time
```

For a dynamic list:

```kotlin
for (pkg in offering.availablePackages) {
    render(pkg.product.title, pkg.product.price.formatted, pkg.packageType)
}
```

### 3.2 Purchase with the default option

When the paywall shows a Package and you want the SDK to pick the best offer, pass the Package directly.

```kotlin
val params = PurchaseParams.Builder(activity, monthly).build()
val result = Purchases.sharedInstance.awaitPurchase(params)
```

### 3.3 Drill into `subscriptionOptions` for a specific offer

Use this when the paywall targets an offer by tag or offer ID, for example a win back offer.

```kotlin
val product = offering.monthly?.product ?: return
val winBack = product.subscriptionOptions
    ?.firstOrNull { it.tags.contains("win-back") }
val option = winBack ?: product.defaultOption ?: return
val params = PurchaseParams.Builder(activity, option).build()
```

Always fall back to `defaultOption` so the paywall still works when the targeted offer is absent (for example, the user is not eligible).

### 3.4 Render trial and intro pricing from `pricingPhases`

The first `PricingPhase` is the trial or intro price when present. Use `offerPaymentMode` for trial detection.

```kotlin
val option = pkg.product.defaultOption ?: return
val first = option.pricingPhases.first()
val isTrial = first.offerPaymentMode == OfferPaymentMode.FREE_TRIAL
```

`billingPeriod.value` is the count in the period's unit, not days. A `P1W` period gives `value = 1`, `unit = WEEK`. Build labels off both fields:

```kotlin
val p = first.billingPeriod
val label = when (p.unit) {
    Period.Unit.DAY -> "${p.value} day"
    Period.Unit.WEEK -> "${p.value} week"
    Period.Unit.MONTH -> "${p.value} month"
    Period.Unit.YEAR -> "${p.value} year"
    else -> p.iso8601
}
```

### 3.5 Prepaid plans

Prepaid base plans use the same `SubscriptionOption` API. Their `pricingPhases` report `RecurrenceMode.NON_RECURRING`. To accept pending purchases for prepaid plans, enable the flag at configuration time.

```kotlin
PurchasesConfiguration.Builder(context, apiKey)
    .pendingTransactionsForPrepaidPlansEnabled(true)
    .build()
```

### 3.6 Check access after purchase

Prefer entitlements. They reflect server computed access state including grace period, account hold, and cancellation with remaining time.

```kotlin
val info = result.customerInfo
val isPro = info.entitlements["pro"]?.isActive == true
```

If you need the raw product ID, use `customerInfo.activeSubscriptions`. It returns a `Set<String>` of `"subscriptionId:basePlanId"` entries.

## Decision summary

| Question | Answer |
|---|---|
| How do I fetch products? | `Purchases.sharedInstance.awaitOfferings()` then `offerings.current`. |
| How do I present durations? | `offering.monthly`/`annual`/`weekly` or iterate `availablePackages`. |
| How do I purchase? | Pass the `Package` to `PurchaseParams` and let `defaultOption` apply. |
| How do I target a specific offer? | Filter `product.subscriptionOptions` by tag or ID, pass the `SubscriptionOption`. |
| How do I detect a free trial? | `pricingPhases.first().offerPaymentMode == OfferPaymentMode.FREE_TRIAL`. |
| How do I check access? | `customerInfo.entitlements["<id>"]?.isActive`. |

## References

- [Full chapter](https://www.revenuecat.com/guides/revenuecat-android-sdk/subscriptions-with-revenuecat)

© RevenueCat · MIT · RevenueCat/ai-toolkit

Similar skills

Everything for Mobile →

From the same set33

revenuecat-customer-center Adds RevenueCat's ready-made Customer Center screen so subscribers can cancel, request refunds and restore purchases without custom UI. CX Codex +1 715installs revenuecat-migrate A skill that walks an app through adopting RevenueCat or bumping the SDK to a new major version. It detects the platform first, then follows the steps. CX Codex +1 700installs rc-webhooks A skill for handling RevenueCat webhooks server-side: the event schema, deduplication by event.id, and the difference between cancellation, expiration and renewal. CX Codex +1 650installs rc-security Walks an agent through a RevenueCat security review on Android: signature verification mode, API key hygiene, user identity and server-side entitlement checks. CX Codex +1 649installs rc-backend A skill for reading and updating RevenueCat state from your server: subscribers, promotional entitlements, attributes over the REST API. CX Codex +1 635installs rc-setup Walks you through the RevenueCat dashboard and the Google Play connection: app, service account, entitlements, offerings, and the public API key. CX Codex +1 638installs rc-configuring-the-sdk A skill that walks the agent through wiring RevenueCat into an Android app: the Gradle dependency, Purchases.configure, app user id strategy and log level. CX Codex +1 636installs rc-testing Configures RevenueCat Test Store on Android, wraps the Purchases SDK for MockK unit testing, and sets up headless CI checks in GitHub Actions. CX Codex +1 627installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor