Skip to content

Android: sell Pro in the app through RevenueCat when a key is configured - #182

Open
vood wants to merge 10 commits into
mainfrom
ccr-31b96bc5-6cq34h
Open

vood wants to merge 10 commits into
mainfrom
ccr-31b96bc5-6cq34h

Conversation

@vood

@vood vood commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Moves payments into the apps with RevenueCat. Android and iOS.

Android

  • RevenueCat 11.3.0 (purchases and purchases-ui). The SDK needs Kotlin 2.2, which brings KSP2, so the toolchain moved: Kotlin 2.2.21, KSP 2.2.21-2.0.5, Room 2.7.2, Hilt 2.57.2, Compose BOM 2026.06.01. Room 2.6.1 and Hilt 2.52 fail under KSP2; nothing else was bumped.
  • PurchasesManager: the pro entitlement, the current offering's Monthly and Annual packages with store prices, purchase, restore, and login with the account user id. Packages come from the offering's standard slots, falling back to the monthly and yearly product ids.
  • Plans sold: Monthly and Annual. Lifetime is not sold in the Android app.
  • The onboarding paywall step stays native and shows store prices.
  • Settings "Upgrade to Pro" and a dictation blocked by the word limit open the RevenueCat paywall (PaywallDialog, gated on pro). A block in the floating mic opens the app with the paywall.
  • Settings shows "Manage subscription" (RevenueCat Customer Center) once the store entitlement is active, next to "Restore purchases".
  • A signed-out user sees "Upgrade to Pro" and "Restore purchases" in Settings when Pro is sold in the app, since a store purchase needs no account; the browser checkout still asks for sign-in first.
  • Onboarding: a purchase on the paywall step ends onboarding; the main button stays at one height on every step, with messages above it; the "Try it now" demo goes straight from waiting to listening.
  • Onboarding rating step: five stars and a question as the title. This overlaps with Ask for a rating after the first dictation on Android; drop it from iOS onboarding #183, which reworks the same step differently on purpose; one of the two has to give way.
  • A purchase the store accepted but could not confirm over the network reports that it is unconfirmed, instead of "You have not been charged".
  • Release builds drop a Test Store key (test_...) at build time and keep the browser checkout; verifyReleaseRevenueCatKey fails the build if one reaches the release BuildConfig. The app also ignores such a key at runtime outside debuggable builds.
  • supabase/functions/revenuecat-webhook and a migration write a subscription to profiles.subscription_status; an AppSumo deactivation does not downgrade an account with an active store subscription.
  • CI passes the REVENUECAT_ANDROID_API_KEY secret through as REVENUECAT_API_KEY. No key is committed.

Android: verified

  • ./gradlew testDebugUnitTest (141 tests) and :app:assembleDebug pass with the Test Store key set and with it blank. :app:lintDebug passes.

  • With the Test Store key set, the release BuildConfig key is empty; the release-variant key test passes.

  • On the Pixel 6 API 33 emulator, debug build, Test Store key: the onboarding paywall loaded the offering with store prices; a simulated Test Store purchase unlocked Pro (the paywall step dropped out, Settings showed "Unlimited words"); Customer Center opened and listed the purchase. That purchase was of the Lifetime product, made before Lifetime was removed from the app; Monthly and Annual use the same purchase path but were not bought.

  • On a Pixel 10 Pro, debug build, Test Store key: after "Continue with the trial", Settings showed "Upgrade to Pro", "Restore purchases" and "Continue with Google"; dictation transcribed.

Android: not verified

  • The RevenueCat paywall from Settings and from a word-limit block was not opened on a device.
  • Sign-in identity sync, restore, and the subscription webhook were not exercised.
  • No Google Play purchase: needs a Google Play app in RevenueCat, the monthly and yearly Play subscriptions, and the goog_ key as the REVENUECAT_ANDROID_API_KEY secret.
  • A minified release build was not made locally (no keystore here).
  • The webhook function has not been type-checked or deployed, and the backend that serves aidictation.com is not in this repository.

Needed before turning Android on

  • The webhook deployed where profiles lives, with REVENUECAT_WEBHOOK_AUTH set and the same value in RevenueCat's webhook Authorization header.

Inert until configured

With REVENUECAT_API_KEY unset (the case today) the Android app keeps the browser checkout. The toolchain bump applies either way.

iOS

  • purchases-ios-spm 5.103.0 (RevenueCat, RevenueCatUI) linked to the WhisperMateIOS app target only.
  • PurchasesManager configures from REVENUECAT_API_KEY in Secrets.plist, stays inert without it, and ignores a test_ key outside DEBUG so a Test Store key cannot crash a shipped build. It follows customerInfoStream for the pro entitlement, logs RevenueCat in with the account user_id (lowercased) on sign-in and out on sign-out, and restores purchases.
  • SubscriptionManager (shared) treats an active store entitlement as Pro for signed-in and anonymous users. The flag is persisted in the app group, so the keyboard extension can read it; no RevenueCat import in WhisperMateShared.
  • Settings > Account: "Upgrade to Pro" (RevenueCat PaywallView in a sheet), "Manage Subscription" (Customer Center) once the entitlement is active, "Restore Purchases". A word-limit block now presents the paywall as well as the text reason.
  • Plans sold: Monthly and Yearly. Lifetime is not sold; the lifetime package was removed from the default offering in RevenueCat, which now holds Monthly and Yearly only. An account whose plan is already lifetime stays paid, shows "Lifetime" in Settings, and gets no Upgrade row and no paywall.
  • ios-appstore-connect.yml passes an optional REVENUECAT_API_KEY secret into the generated Secrets.plist. It is not in the required list, so builds without it are unchanged.

iOS: verified in the Simulator (Test Store key, DEBUG)

  • WhisperMateIOS builds; the macOS target compiles; the unit tests pass, including two new ones pinning that a lifetime plan stays paid, unlimited and named "Lifetime".
  • Settings showed "Upgrade to Pro" and "Restore Purchases"; the paywall loaded the offering with Monthly, Yearly and Lifetime. That was before Lifetime was removed from the offering; the paywall was not reopened afterwards.
  • A Test Store purchase of Monthly flipped the Account section to Pro with unlimited words, and "Manage Subscription" opened Customer Center showing the active subscription.
  • After the paywall was published in RevenueCat, a fresh install showed Free with "Upgrade to Pro", and the published paywall rendered in place of the fallback with Annual and Monthly only, Restore Purchases, Terms and Privacy Policy. Prices shown were the Test Store's ($79.99/yr, $9.99/mo), not the App Store's.
  • Both rating asks (onboarding step, post-use prompt) are still in place and untouched by the purchase changes; checked by reading.

iOS: not verified

  • The word-limit paywall, sign-in/sign-out identity sync, restore, and the keyboard reading the flag were not exercised.
  • The existing-Lifetime path in the app (Settings label, no Upgrade row, no paywall) was checked by reading the code, not by signing in with a lifetime account.
  • App Store Connect now has subscription group "AI Dictation Pro" with yearly ($84.99, 1 year) and monthly ($8.49, 1 month), available in all 175 regions at Apple's auto-converted prices, with English (U.S.) names, review notes and a paywall screenshot. Both are "Prepare for Submission"; nothing was added for review. No trial, no lifetime.
  • RevenueCat has no App Store app yet (the in-app purchase key file has not been uploaded), so the store products are not attached to pro or the offering, there is no appl_ key, and no sandbox purchase was made.
  • No StoreKit purchase: needs an App Store app in RevenueCat, the Monthly and Yearly subscriptions in App Store Connect, and the appl_ key as the REVENUECAT_API_KEY secret.

Generated by Claude Code

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

PurchasesManager wraps the RevenueCat SDK (Google Play Billing): the pro
entitlement, the monthly and annual packages of the current offering with
their store prices, purchase and restore. The signed-in user id is the
RevenueCat app user id. With REVENUECAT_API_KEY unset the app keeps the
browser checkout and behaves as before.

Add a revenuecat-webhook function and migration so the purchase reaches
profiles.subscription_status, and keep an AppSumo deactivation from
downgrading an account with an active store subscription.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AyApq9dpwrhoZtdTSEz7B4
@vood
vood deployed to pull-request November 15, 2026 23:30 — with GitHub Actions Active
Adds the RevenueCat SDK to the iOS app target only. PurchasesManager stays
inert without REVENUECAT_API_KEY and ignores a Test Store key outside DEBUG.
An active pro entitlement counts as paid in SubscriptionManager for signed-in
and anonymous users. Settings > Account gets Upgrade to Pro, Manage
Subscription and Restore Purchases; a word-limit block presents the paywall.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vood
vood deployed to pull-request November 16, 2026 03:27 — with GitHub Actions Active
Move to RevenueCat 11.3.0 and add purchases-ui. The SDK needs Kotlin 2.2,
which brings KSP2, so Kotlin goes to 2.2.21, KSP to 2.2.21-2.0.5, Room to
2.7.2 and Hilt to 2.57.2 (the older Room and Hilt fail under KSP2), and the
Compose BOM to 2026.06.01.

Add the Lifetime plan next to Monthly and Annual: the offering's lifetime
package, a one-time purchase, shown on the onboarding paywall once the store
has priced it. Packages come from the offering's standard slots, falling
back to the monthly, yearly and lifetime product ids.

Settings "Upgrade to Pro" and a dictation blocked by the word limit open the
RevenueCat paywall, gated on the pro entitlement. Settings shows "Manage
purchase" (Customer Center) when the store entitlement is active.

Release builds drop a Test Store key (test_...) and keep the browser
checkout; verifyReleaseRevenueCatKey fails the build if one gets through.

The webhook records the one-time Lifetime purchase as lifetime, and a later
subscription expiry or an AppSumo deactivation no longer downgrades it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Remove Lifetime from the plan model, the onboarding paywall and the store
package lookup, and take the lifetime handling back out of the RevenueCat
and AppSumo webhooks. The Settings row for Customer Center is "Manage
subscription" again.

A purchase the store accepted but that could not be confirmed over the
network no longer says "You have not been charged": it reports that the
purchase is unconfirmed and unlocks once it goes through.

Fix three resource lookups that the newer Compose lint rejects, which
failed the CI lint step after the Compose BOM bump.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vood
vood deployed to pull-request November 16, 2026 03:49 — with GitHub Actions Active
Tapping the mic on the "Try it now" step showed the processing pill while
the microphone opened. The demo now has a starting state that looks like
listening, so a tap goes from waiting to listening with nothing between.

The rating step shows five stars instead of one, which read as a one-star
score, and asks for the rating as a question.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vood
vood deployed to pull-request November 16, 2026 04:10 — with GitHub Actions Active
Messages that sat under the button (the permissions hint such as "All
set.", the paywall terms) pushed it up on those steps. They now sit above
the button, and the space under it is a fixed slot that holds the secondary
action where a step has one, so the button no longer moves between steps.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vood
vood deployed to pull-request November 16, 2026 04:12 — with GitHub Actions Active
The paywall leaves the step list once the account is Pro, so a purchase
made on it dropped the user back on the previous step, the rating page.
A purchase on the paywall now ends onboarding.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vood
vood deployed to pull-request November 16, 2026 04:16 — with GitHub Actions Active
Settings showed "Upgrade to Pro" and "Restore purchases" only to signed-in
users, which was right for the browser checkout but left a trial user who
skipped the onboarding paywall with no way to buy once Pro is sold in the
app. A store purchase needs no account, so both rows now show to a
signed-out user when Pro is sold in the app. The browser checkout still
asks for sign-in first.

The rules for which Account rows appear are a pure function with tests.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vood
vood deployed to pull-request November 16, 2026 04:20 — with GitHub Actions Active
Lifetime is no longer sold, but accounts that have it stay paid. The
paywall request now also checks the account plan, and two tests pin
that a lifetime plan stays paid, unlimited and named Lifetime.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A RevenueCat key alone switched the app to in-app selling, so a key set
before the Play products exist (or offerings that fail to load) would leave
no way to buy: the browser checkout was off and the store had nothing.

The app now sells in the app only when the current offering holds at least
one purchasable plan. Until then onboarding, Settings and the word-limit
block behave exactly as with no key. A failed offerings load is retried.
An existing store purchase stays manageable either way.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vood
vood deployed to pull-request November 16, 2026 05:29 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
pull-request — df1877ad Deployed Nov 16, 2026 by vood via Build & Test #370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants