Skip to content

Prepaid code: fixes before PREPAID_CODE_REDEEM can turn on (switch stays off) - #26166

Merged
kodjima33 merged 2 commits into
mainfrom
feat/prepaid-code-turn-on-fixes
Nov 23, 2026
Merged

kodjima33 merged 2 commits into
mainfrom
feat/prepaid-code-turn-on-fixes

Conversation

@kodjima33

@kodjima33 kodjima33 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Follow-up to #26146, which merged with PREPAID_CODE_REDEEM off. Round 2 of the general and money reviews listed what must be fixed before the switch can turn on for anyone. This PR does those fixes. The prod switch stays off and nobody is added to the cohort.

  1. Stay offer (money, N1). A prepaid plan made with a once code (first month included) has no discount after its first invoice, so utils/retention_offer.evaluate offered the stay discount. Accepting it would clear cancel_at and renew the plan with no card, or charge a saved card without fresh consent. evaluate now refuses any subscription carrying the prepaid marker (reason='prepaid'), and accept goes through the same check. Other offers on this path:
    • the monthly downsell (utils/monthly_switch.py) only acts on a past_due yearly subscription, which a $0 monthly prepaid plan never is, and it refuses cancel_at;
    • the yearly switch refuses cancel_at;
    • no win-back or trial-extension endpoint exists.
  2. The prepaid marker no longer follows the switch. subscription.prepaid stays in the subscription response whenever the stored plan has it, so a redeemed reader keeps "Your Omi Pro plan ends {date}." if the switch goes off or they leave the cohort. Only prepaid_code_redeem (the ability to redeem) follows the switch. For readers without a prepaid plan, switch-off responses stay byte-identical (tested).
  3. Server-side Play check on redeem. POST /v1/payments/prepaid-code/redeem refuses with 409 play_billed when config.play_billing.client_uses_play is true for the caller (same X-App-Platform / X-App-Build headers and helper as the subscription response). It refuses before the rate-limit bucket or any Stripe call. Note: checkout itself is still client-gated only for Play-billed builds; this PR does not change that.
  4. Portal before the webhook. The stored-row check stays. The portal endpoint now also lists the customer's Stripe subscriptions and refuses when any one that can still bill carries the marker. Stripe has the marker from creation, so this covers the seconds before the webhook writes the row, and a lost webhook. Cost: one read-only Stripe call per portal open. I chose this over refusing during an in-flight claim because claims are keyed by promotion code, not uid.
  5. Clean-ups.
    • Removed the dead PrepaidCodeSource / source parameter left after the analytics cut.
    • The has_plan message now gives a next step: "You already have a plan. Your code was not used. Redeem it after your plan ends." This is in all 49 locales via scripts/l10n.py.
  6. Evidence. The MUX simulator scenario was run on one lane (sim, iPhone 17 Pro, real backend plus loopback Stripe stub, switch on locally), in light and dark.

Screenshots (iPhone 17 Pro simulator)

One code row Discount code hand-off Prepaid plan view Paywall closes after redeem

Full frames: ~/mobile-ux-agent/runs/2026-11-23/p1/r3-light/ and r3-dark/ (12 states each). The stale after-*/03-plans-sheet-entry.png and after-*/10-plans-after-redeem.png are replaced.

Money-safety: changed lines

  • backend/utils/retention_offer.py evaluate: prepaid marker check before any other rule.
  • backend/routers/payment.py: _customer_has_prepaid_subscription and its call in create_customer_portal_endpoint.
  • backend/routers/redeem_code.py: Play check before the rate limit and the redeem call.
  • backend/routers/users.py _apply_prepaid_code_switch: no longer strips subscription.prepaid.

How it was verified

  • Backend:
    • tests/unit/test_retention_offer.py (36, including a once-shaped prepaid subscription: evaluate refuses and accept makes no Stripe write);
    • tests/unit/test_prepaid_code_redemption.py (48: marker kept with the switch off and switch-off bytes unchanged for others, Play caller refused, portal refused before the webhook and open for ended or ordinary subscriptions);
    • 182 neighbouring files one by one; test.sh timing guard; backend/scripts/typecheck.sh 0 errors;
    • OpenAPI and the Dart, TS and Swift clients regenerated (the redeem route gained two optional headers).
  • App: prepaid_code_sheet_test.dart and play_billing_plans_sheet_test.dart, including a new test that the prepaid plan view stays with the switch off. 788 tests across 68 neighbouring files pass. l10n.py check passes.

Not verified

  • Live Stripe and the production webhook grant (sandbox and stub only).
  • Whether Stripe emails anything for $0 invoices.
  • A Checkout session already open with the code applied.
  • The live Stripe portal configuration.
  • Android on a device or emulator (widget tests only).
  • Desktop, Windows and web are not prepaid-aware; they show the server's 409 text on Manage or Cancel (UX only, no money path).

Product invariants affected

none

Line-count exceptions

Line-Count-Exception: backend/routers/payment.py | 2418 -> 2432 | the portal guard must sit in the portal endpoint it protects

View guided diff Turn on auto-fix

Stay offer refused for a prepaid subscription (a once code leaves no discount);
a stored prepaid plan keeps its marker whatever the switch; redeem refuses a
Play-billed Android caller; the portal checks Stripe's own marker before the
webhook lands; has_plan copy gives a next step; dead source parameter removed.
@kodjima33 kodjima33 added the mux-proposal Mobile UX improver (MUX) proposal; waits for Nik's ship label Nov 23, 2026
@mintlify

mintlify Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Nov 23, 2026, 8:00 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@kodjima33
kodjima33 marked this pull request as ready for review November 23, 2026 19:59
@kodjima33
kodjima33 merged commit 3bfde75 into main Nov 23, 2026
78 of 80 checks passed
@kodjima33
kodjima33 deleted the feat/prepaid-code-turn-on-fixes branch November 23, 2026 20:41
kodjima33 added a commit that referenced this pull request Nov 23, 2026
…es a prepaid plan (switch stays off) (#26171)

## What changed and why

Follow-up to #26166 from its review ("Ranked fixes before on for all").
Backend only. `PREPAID_CODE_REDEEM` stays `off` and nobody is added to
the cohort.

1. **Portal reads Stripe only when needed.** `POST
/v1/payments/customer-portal` listed the customer's Stripe subscriptions
for every payer, switch on or off, and a Stripe error there was a raw
500 with no log line. Now:
- When the stored row is a live paid plan without the prepaid marker
(active, paid plan, period end not passed), the list call is skipped.
Redeem refuses anyone with a live plan, so such a row can't sit next to
a prepaid plan. This is the normal payer, who now makes zero extra
Stripe calls.
- For a free, ended or unmarked row, the list still runs. That is where
the before-webhook and lost-webhook window lives. It is not gated on the
switch.
- A Stripe error there is logged and answered with `503 "Could not
verify your subscription. Please try again."`, the same shape the
checkout path uses.
2. **`/v1/payments/redeem-code` refuses a prepaid plan.** A plan made
with a `once` code has no discount after its first invoice, so this path
would attach a new discount and burn that code. It now refuses with 409
before any claim or Stripe write, and the code is not consumed.
3. **Small items from the review:**
- Cancel feedback order: fixed. A refused prepaid cancel no longer
stores cancellation feedback; feedback is now stored after the prepaid
check.
- `_resume` live-plan check: **not changed, known.** It isn't a few-line
fix. When the claim has no subscription id, the redemption may already
have created its own prepaid subscription (Stripe succeeded, the server
died before recording it). A plain `_has_live_plan` re-run would see
that subscription and refuse the reader's own redemption. Doing it right
means excluding the subscription created for this promotion code from
both the stored-row and Stripe checks. The path is only reachable after
an ambiguous 503 more than 24 hours earlier.

Out of scope here: hiding Manage and Cancel for a prepaid plan on
desktop, Windows and web.

## Money-safety: changed lines

- `backend/routers/payment.py` `create_customer_portal_endpoint`: the
live-paid-row skip, plus the Stripe error to logged 503.
- `backend/routers/payment.py` `cancel_subscription_endpoint`: feedback
is stored after the prepaid guard.
- `backend/utils/promotion_redemption.py` `redeem_promotion_code`:
refuses a subscription with the prepaid marker.

## How it was verified

- `tests/unit/test_prepaid_code_redemption.py` (51), covering:
- a normal monthly payer opens the portal with zero `Subscription.list`
calls;
- a free row with a marked Stripe subscription is refused, while an
ended prepaid plan or an ordinary subscription opens the portal;
- a Stripe list error gives 503 with a log line and the portal not
opened;
  - a refused prepaid cancel with a reason stores no feedback.
- `tests/unit/test_promotion_redemption.py` (24): a once-shaped prepaid
plan is refused with 409, with no claim, no promotion-code change and no
subscription change.
- 121 neighbouring backend files pass one by one, the `test.sh` timing
guard passes, and `backend/scripts/typecheck.sh` has 0 errors.

## Not verified

- Live Stripe and the production webhook grant (sandbox and stub only).
- The live Stripe customer portal configuration.
- Real portal volume and latency (not read from analytics).

## Product invariants affected

none

## Line-count exceptions

Line-Count-Exception: backend/routers/payment.py | 2432 -> 2445 | the
skip and the 503 must sit in the portal endpoint they guard


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26171?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26171?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26171&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
kodjima33 added a commit that referenced this pull request Nov 24, 2026
…6247)

## Problem

Google Play Billing for Android is merged and off in prod. On an Android
build the server puts on Play, there is no way to activate a Shopify "12
months included" bundle code or a prepaid code: the app hides "Have a
code?" (`usage_provider.dart` canRedeemPrepaidCode,
`play_plans_content.dart` has no code row, the trial paywall hides the
hint) and the server answers 409 `play_billed` to a Play client
(`routers/redeem_code.py`). About 78 Android upgrades a month use one of
these codes at Stripe checkout today, and about 32 users a week contact
support because a code does not land (play-go-nogo.md section 4). Nik's
decision (Nov 24): in-app code entry on the Play build.

## Change

Server (`routers/redeem_code.py`, `routers/users.py`):
- A client where `client_uses_play(platform, build, uid)` is true can
redeem whatever `PREPAID_CODE_REDEEM` and its cohort say: `GET
/v1/users/me/subscription` carries `prepaid_code_redeem: true`, and
`POST /v1/payments/prepaid-code/redeem` runs the redemption instead of
409 `play_billed` / 404.
- Nothing else in the redemption changed: same code checks, one
redemption per code, same claim, same $0 no-card subscription ending one
hour before the first full-price renewal, same marker, same per-user
rate limit. It still refuses a reader with a live Stripe subscription, a
live or recoverable Play purchase (the #26232 admission, including
`play_check_unavailable` as a 503 `try_again`).
- Reverse guard: buying Play next to a live prepaid plan is already
refused (`utils/play_billing.py` `_live_stripe_subscription`, paginated
non-terminal scan from #26232; the prepaid subscription is `active`
until its term). Tests added, no code change needed.
- iOS, web, desktop and Android below the Play minimum build follow the
switch exactly as before.

App:
- `play_plans_content.dart`: a free reader on a Play build sees the
existing "Have a code?" entry (same `PrepaidCodeEntry`, same text style,
centered like the Stripe sheet's) as the last row, under Subscribe,
Restore and the Play disclosure. It opens the existing prepaid code
sheet unchanged. No discount-code hand-off, link or price.
- Trial paywall: the same entry where the Stripe code hint is hidden
today (provider change only).
- `usage_provider.dart` `canRedeemPrepaidCode`: no longer hides on a
Play build; never shows to a paid reader on a Play build (Play or
Stripe, any status) or before the billing provider is known.
- `plans_sheet.dart`: a Play build never shows the Stripe storefront; a
prepaid plan reaches its existing "Your Omi Pro plan ends <date>." body.
At term end the plan is Free again and the Play plans come back.
- `plan_cards.dart`: at accessibility text sizes the price stacks under
the title. The Play plans sheet overflowed by 486 px at the largest size
on main; default sizes are unchanged.
- No new strings. Changelog fragment
`app/changelog/unreleased/20261124-play-code-entry.json` (android).

## Impact estimate

If a bundle or prepaid code can be entered on the Play build, the about
78 Android code upgrades a month keep working after the Play switch (0
of them would activate without it), and code-related support contacts on
Android go from about 32 a week across platforms toward 0 for Play-build
users.

Reach today: one throwaway Play-cohort test uid (see review round 1,
item 4); no real user until the Play switch is flipped.

Basis: 78/month Android code upgrades and 32/week code contacts are from
the brief (play-go-nogo.md section 4 and the redemption reviews of
#26146/#26166).

## Evidence

Widget-test renders (Android, Play config present, Free reader). Paths:
`~/mobile-ux-agent/runs/2026-11-24/g3/`.

![Play plans sheet with Have a
code?](https://raw.githubusercontent.com/BasedHardware/omi/9c6b569cb728771472e6b478eb3c59b9f33ac30f/.agent-artifacts/ui-evidence/mux-2026-11-24-play-code-entry/001-mobile-android-play-plans-code-entry.png)
![Play plans sheet, largest
text](https://raw.githubusercontent.com/BasedHardware/omi/9c6b569cb728771472e6b478eb3c59b9f33ac30f/.agent-artifacts/ui-evidence/mux-2026-11-24-play-code-entry/002-mobile-android-play-plans-code-entry-xxxl.png)
![Trial paywall on a Play
build](https://raw.githubusercontent.com/BasedHardware/omi/9c6b569cb728771472e6b478eb3c59b9f33ac30f/.agent-artifacts/ui-evidence/mux-2026-11-24-play-code-entry/003-mobile-android-trial-paywall-code-entry.png)
![Trial paywall, largest
text](https://raw.githubusercontent.com/BasedHardware/omi/9c6b569cb728771472e6b478eb3c59b9f33ac30f/.agent-artifacts/ui-evidence/mux-2026-11-24-play-code-entry/004-mobile-android-trial-paywall-code-xxxl.png)

## Tests

Backend (`tests/unit/test_play_prepaid_code_entry.py`, new):
- Byte identity through the real routes (FastAPI TestClient on the users
and redeem routers): every client (iOS, web, macOS, Windows, Android
1616, 1623, a Play-qualifying build, no headers) under prod settings
(`ANDROID_BILLING=stripe`, empty Play cohort,
`PREPAID_CODE_REDEEM=cohort` with an empty cohort), and with the switch
off or on, gets main's exact bytes for both routes. Pins come from
origin/main 120dfa4 running the same harness
(`test_pin_main_responses`, regenerated with main's two routers checked
out; deterministic across two runs). With `ANDROID_BILLING=play`, every
non-Play client also gets main's bytes.
- Play client with the switch off: offered (only `prepaid_code_redeem`
added to main's body) and redeems; a non-Play client with the switch off
gets 404 before the rate limit or lookup; a Play cohort member on a
Stripe server can redeem.
- Through the real redemption: no-card plan ending with the term, same
reader again returns the same redemption, another account gets
`code_used`; refused with `has_plan` next to a live Stripe subscription,
a live Play row, an active, on-hold or paused Play purchase read from
fake Google; 503 `try_again` when Google cannot be read; nothing created
or claimed in each refusal.
- Reverse: a Play purchase next to a live prepaid subscription is
refused with `stripe_subscription_active` and nothing granted; a stored
prepaid row also blocks; an ended prepaid plan does not.
- 9 of these fail with main's routers (all the Play-client allow and
refusal cases); the byte-identity cases pass on both by design. Updated:
`test_prepaid_code_redemption.py` (the old 409 `play_billed` test now
asserts the Play client redeems and iOS / old Android still follow the
switch) and `test_play_billing.py` (Play build response now also carries
`prepaid_code_redeem`).
- Ran: `test_play_prepaid_code_entry`, `test_prepaid_code_redemption`,
`test_play_billing`, `test_play_billing_guards`,
`test_play_billing_money`, all `test_payment_*` and `test_users_*`:
pass.

App (`play_billing_plans_sheet_test.dart`): entry under Subscribe and
Restore with the Stripe sheet's text style at x1 and x3.2; trial paywall
entry at x1 and x3.2 opening the sheet; hidden for Play and Stripe
subscribers (x1, x3.2), a paid non-active plan, when the server does not
offer it, and before the provider is known; redeem success shows "Your
Omi Pro plan ends", then the prepaid body with no Play purchase, then
Play plans again at term end; no storefront for a prepaid plan on a Play
build; the three refusal messages (`has_plan`, `code_used`,
`try_again`); off a Play build the Stripe sheet keeps its own entry. 9
fail with main's app code. Ran with Flutter 3.44.5 (after round 2, 25
suites, 232 tests, plus the three files above):
plans_sheet_{selection,checkout_refresh,redeem_code,cancel_pending},
prepaid_code_sheet,
trial_paywall_{page,navigation,monthly_offer,real_font,trust}, the four
usage_provider suites, plan_option_card_tap, contextual_plans_fallback,
billing_currency_surfaces: all pass. `flutter analyze` on changed files:
one existing info in trial_paywall_page.dart:185 (not touched). `make
preflight` with this body.

## Review round 1 fixes (#26247)

1. **Redeeming from a paywall no longer strands the reader.** The
auto-close on Outline, Trial and the trial upsell acts only while that
page is the top route (`ModalRoute.of(context)?.isCurrent`, re-checked
in the post-frame callback) and does not latch `_dismissed`/`_closed`
when it skips. `ModalRoute.of` rebuilds the page when it is on top
again. On the Trial paywall the code-success sheet stays until Done or
Android back, then the existing `onRedeemed` closes the paywall with
`true`. Prepaid readers are not exempted: an open paywall still closes
for them once nothing covers it. Only the Trial paywall has the code
entry; Outline and the upsell are tested with another route covering
them.
2. **Code entry eligibility** (`UsageProvider.canRedeemPrepaidCode`):
hidden when the latest subscription read failed after an earlier success
(`_subscriptionReadFailed`; the cached Play setup still governs
purchases exactly as before), and when the reader shows Free with a
`payment_issue` and a `stripe_subscription_id` (a past-due Stripe
agreement). The subscription response exposes nothing for a Play
purchase on hold or pending on a Free row, so the app cannot hide the
entry for that reader; the server refusal (`has_plan` from the #26232
admission) stays the guard there. These two checks apply on every
platform, but only change anything where the entry shows (Play builds,
and the prepaid cohort elsewhere, empty in prod).
3. **Prepaid redemption next to a Play purchase.** (a)
`utils/prepaid_code_redemption.py`: after the code claim is taken and
right before the Stripe create, redemption reads the user document and,
for a reader with Play history, Google again (the same #26232
admission). A Play purchase that is now live or recoverable releases the
claim and answers 409 `has_plan`; Google unreadable releases it and
answers 503 `try_again`. This narrows the window; it does not close it.
(b) `utils/play_stripe_guard.py` (Stripe webhook, `routers/payment.py`)
never cancels or refunds a subscription carrying the prepaid marker: it
keeps it and logs `prepaid_code_play_overlap uid=<uid> purchase=<first
12 hex> code=<promotion code id>` at ERROR each time. The Play-side
observation (`utils/play_billing.py` `_record_stripe_conflict`) logs the
same line instead of a double charge, with no user notice, when the only
Stripe subscriptions are prepaid ones; a paid card subscription there is
still a double charge as before. Runbook section added:
`backend/docs/runbooks/play-billing-double-charge.md`, "Prepaid code
next to Google Play". No automatic cancel or refund anywhere.
4. **Not a no-op for one account today.** With today's prod settings,
the one throwaway uid in the Play cohort can redeem a code on a
qualifying Android build (it gets `prepaid_code_redeem: true` and the
route answers instead of 404). Every other account and client gets
main's bytes.

Tests: app `play_billing_plans_sheet_test.dart`: Trial redeem, success
sheet visible, Done closes the paywall with `true`; same with Android
back; Outline, Trial and upsell covered by another route when the reader
turns out to pay outside Play: the cover is never popped, the paywall
closes once after it, result `false`, a later refresh pops nothing;
past-due Stripe and failed latest read hide the entry on the plans sheet
and the Trial paywall, keep `buysThroughPlay`, and a good read brings it
back. 9 fail on the previous head. The hosted navigation test now closes
the page by Android back and asks for a URL the Play rule would allow
(it fails with the close guard removed). Backend
`test_play_prepaid_code_entry.py`: Play verified between the first check
and the create refuses and frees the code; Google unreadable at the
re-check frees it; Play verified after the re-check keeps both, the
webhook guard never cancels the prepaid subscription and logs the line
each time, the claim still points at the subscription; an ordinary paid
Stripe subscription next to live Play is still cancelled and refunded
(webhook and checkout paths); the Play-side observation logs the prepaid
line with no notice and still reports a real double charge. 5 fail on
the previous head. `test_play_billing_guards.py` read count updated for
the re-check (one more user-document read). Byte-identity tests
unchanged and passing. Backend type check (`scripts/typecheck.sh`): 0
errors.

## Money review round 2 follow-ups (#26231's remaining items before Play
can be switched on)

From `~/mobile-ux-agent/runs/2026-11-24/g2/money-review.md`, "Round 2",
"Remaining items before this PR's part can be GO".

1. **Already-open native paywall.** New
`UsageProvider.paywallClosedForPlay`: a paid plan not billed by Play on
a Play build. An open Outline or Trial paywall (and the Stripe trial
upsell on any Play build) closes with `false` as soon as that state is
known, the same result a tap gets today (`alreadyPaid`), so no Stripe
price or Upgrade CTA stays on screen and there is no skeleton.
Same-price Resubscribe while a Stripe cancel is pending stays open; a
prepaid plan never gets it. Files: `outline_paywall_page.dart`,
`trial_paywall_page.dart`, `trial_upsell_sheet.dart`,
`usage_provider.dart`.
2. **Home payment row copy on a Play build.** "Update your card at
omi.me to get {plan} back." is replaced by "Your {plan} plan is paused."
(title kept), real translations in all 49 locales via `scripts/l10n.py`;
the old key is removed. Off a Play build the row is unchanged.
3. **Hosted paywall lifecycle.** `web_paywall_page.dart` re-checks
closed, mounted and the Play gate after the catalog await and before
building the controller or calling `loadRequest`; a closed or disposed
page's navigation delegate always answers prevent.
4. **Real refusal statuses.** Tests now use the backend's shapes and
statuses: 409 `use_google_play`, 400 `play_subscription_on_hold`, 400
`play_check_unavailable`. `monthly_switch_sheet.dart`: a 400
`play_check_unavailable` is transient and keeps Confirm (tested with a
second tap).

Tests (`play_billing_plans_sheet_test.dart`,
`payment_issue_row_test.dart`, `unit/payment_refusal_test.dart`): open
Outline, Trial and upsell paywalls refreshed to paid Stripe + Play close
with no Stripe price, CTA or spinner and result `false`; cancel-pending
Resubscribe stays; hosted page with Play arriving during the catalog
wait records no `loadRequest`; a navigation callback after close answers
prevent (and navigate while open, off Play); monthly 400
`play_check_unavailable` keeps Confirm; row copy names no place to pay.
7 of these fail with the five lib files reverted.

![Home payment row on a Play
build](https://raw.githubusercontent.com/BasedHardware/omi/9c6b569cb728771472e6b478eb3c59b9f33ac30f/.agent-artifacts/ui-evidence/mux-2026-11-24-play-code-entry/005-mobile-android-payment-row-plan-paused.png)
![Home payment row, largest
text](https://raw.githubusercontent.com/BasedHardware/omi/9c6b569cb728771472e6b478eb3c59b9f33ac30f/.agent-artifacts/ui-evidence/mux-2026-11-24-play-code-entry/006-mobile-android-payment-row-plan-paused-xxxl.png)

## Not in this PR

- Manage and Cancel for a prepaid plan on desktop, Windows and web show
the raw 409 text.
- A stuck code claim has no expiry or admin release.
- A prepaid redemption and a Play purchase can still both land in a
narrow race; a person resolves it from the `prepaid_code_play_overlap`
log (runbook).
- The subscription response does not expose a Play purchase on hold or
pending on a Free row, so the app still shows the code entry there; the
server refuses with `has_plan`.
- Live proofs still owed: webhook grant, term end, $0 invoice emails,
portal settings.
- On a Play build a discount (not prepaid) code gets the existing "This
code can't be redeemed here. Use it when you choose a plan." The Play
sheet has no promo field, so that second sentence does not apply there.
- At accessibility text sizes the trial paywall's notes scroll with the
page while Try for Free stays pinned at the bottom, so the entry sits
visually above the pinned button there (same layout the Stripe hint has
on main). The paywall's timeline row also overflows at x3.2 on main; not
touched.

## Not verified

- No emulator or device run; renders are widget-test renders. The
reviewer's item 4 (final qualifying Android build smoke against the
deployed backend) is still owed before enabling.
- No dark-mode render.

Line-Count-Exception: backend/routers/payment.py | 2476 -> 2478 | the
webhook passes the Stripe object to the Play guard so a prepaid
subscription is never cancelled (one call wrapped by the formatter)

UI-Evidence: see the images above
(.agent-artifacts/ui-evidence/mux-2026-11-24-play-code-entry)

## Product invariants affected

none

## Failure class (fixes)

Failure-Class: none

This branch was successfully deployed

1 active deployment
staging - docs — bb4a62ee Deployed Nov 23, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mux-proposal Mobile UX improver (MUX) proposal; waits for Nik's ship

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant