Repository navigation
fix(payment): charge the displayed currency on every Stripe checkout (Play rejection of 1504) - #23604
Conversation
Google Play rejected Android release 1504 because the paywall shows USD while Stripe Checkout, with the account's Adaptive Pricing on, charged non-US buyers a converted local-currency amount. Disable Adaptive Pricing on every subscription checkout session, not only promo-code sessions (#23299), so the charged price matches the price card. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Review round 1 (Luna, FIX-FIRST) has one finding: paid-app Payment Links ( Rebuttal for this PR's scope (the Play rejection):
CI: Backend unit shard 4/6 fails only on |
… (Play currency policy) (#23852) The Android subscription flow could show a bare dollar symbol, omit the post-trial charge, or use a different formatter from Checkout. This change formats the original catalog amount as **US$29.99** (fixture example) in every locale and keeps the exact selected price ID through checkout. Annual offers prominently show the full annual charge. No local prices, currency_options, Stripe catalog changes, account changes, entitlement changes, merge or deployment are included. The previous backend-only fix #23604 disabled Adaptive Pricing. It did not change native/web symbols, backend price_string consumption, trial disclosure, retention copy, or explicitly pin multi-currency Price selection. Adaptive Pricing remains disabled; the session now also sets the selected Price’s original currency and an explicit USD submit notice. ## Purchase-surface audit Line references are in this PR. Catalog unit_amount/amount_minor and currency are price authority; localized copy contains placeholders, never embedded currency symbols. | Surface / strings | File:line | Source and resulting behavior | |---|---|---| | 7-day offer timeline, today/free-days/end dates | app/lib/pages/paywall/trial_paywall_page.dart:190 | ARB trial keys + trialDays=7 + date formatter; end step now includes exact selected post-trial total/interval | | All five trial slides (summaries, transcription, speakers, questions, apps) | app/lib/pages/paywall/trial_paywall_page.dart:323 | ARB feature-only captions; no independent price or trial amount; sticky selected-price terms remain visible on every slide | | Trial monthly/yearly cards, crossed-out annual comparator, annual savings | app/lib/pages/paywall/trial_paywall_page.dart:252 | Catalog amount/currency; shared formatBillingPrice for full total and arithmetic comparator/saving | | Trial CTA and terms: Try for US$0.00; 7 days free, then US$…/month or /year | app/lib/pages/paywall/trial_paywall_page.dart:291 | ARB placeholders + selected catalog currency/amount; switching interval updates terms and exact checkout ID | | Outline full annual/monthly total, secondary monthly equivalent, saving badge | app/lib/pages/paywall/outline_paywall_page.dart:237 | PaywallPrice shared formatter; full annual charge is prominent; discount derives from catalog amounts | | Hosted web paywall monthly/yearly totals and secondary equivalent | app/lib/pages/paywall/web_paywall_page.dart:61; web/paywall/index.html:73 | Flutter shared formatter supplies strings in the host bridge; static page consumes them. Old released hosts retain a fixed, ISO-safe fallback, including whole JPY | | 30-day upsell title/body/claim and new recurring-price terms | app/lib/pages/paywall/trial_upsell_sheet.dart:89 | ARB + trialDays=30 + selected catalog annual/monthly price; same checkout path | | Plans sheet v1 monthly/yearly prices, annual summary, management confirmation | app/lib/pages/settings/widgets/plans_sheet.dart:1292; :513 | Catalog amount/currency + shared formatter; ignores poisoned backend price_string and billing_total | | Plans sheet V2 paid headline and annual summary | app/lib/pages/settings/widgets/plans/storefront_plans_content.dart:211 | Raw StorefrontPrice amount_minor/currency + shared formatter; full annual charge is prominent | | V2 current-plan line, annual saving offer, annual-change confirmation | app/lib/models/plan_storefront.dart:283; :351; app/lib/pages/settings/widgets/plans_sheet.dart:401 | Additive raw current amount/currency and localized templates; saving_minor and raw annual amount use the same Flutter formatter. Original rendered fields remain for installed clients | | Cancel-flow retention: discounted recurring amount; percent/duration offer | app/lib/pages/settings/widgets/cancel_subscription_sheet.dart:209; :287 | Retention API discounted_amount/currency -> shared formatter; ARB percentage/duration slots; no discount policy change | | Promo redemption entry, plan selection, cart discount | app/lib/pages/settings/widgets/plans_sheet.dart:523; :1075 | No separate promo-price string; exact selected catalog price ID + promotion code go to checkout/upgrade; Stripe displays the discount separately in the same pinned currency | | Plan & Usage chat compute budget (capped and uncapped), accessibility copy | app/lib/pages/settings/usage_page.dart:836; app/lib/l10n/app_en.arb:10472 | USD-denominated budget values use formatBillingPrice; chatUsageCost/chatUsageCostNoLimit/chatUsedOfLimitCompute contain formatted placeholders, with no embedded dollar glyphs. Creator payout threshold copy is outside this purchase flow and unchanged | | Stripe cart in PaymentWebViewPage | app/lib/pages/paywall/paywall_checkout.dart:54; app/lib/pages/settings/payment_webview_page.dart:31; backend/utils/stripe.py:57 | Hosted Stripe UI owns cart wording/glyphs. Original selected Price currency is pinned, Adaptive Pricing disabled, locale=auto for language, and USD is explicit in submit copy. No amount conversion by customer address | | Adjacent creator-app Subscribe action | app/lib/pages/apps/app_detail/app_detail.dart:900; app/lib/backend/schema/app.dart:562 | Opens an existing creator PaymentLink; it displays no in-app numeric price. The legacy getFormattedPrice dollar helper has no callers. This is separate from the Omi personal subscription catalog; existing links are unchanged | | Backend v1 price_string and subscription usage prices | backend/routers/payment.py:562; backend/routers/users.py:1517 | Shared backend format_money now uses US$; mobile purchase surfaces do not render price_string | | Backend V2 storefront/current/offer copy; Free price | backend/utils/storefront_copy.py:312; backend/config/storefront_copy_v1.json:90 | USD becomes US$; Free remains zero with identical benefits; legacy amounts/IDs are unchanged | ## Hypotheses and policy limit 1. **Country-local currency:** confirmed as a policy risk, not proven as the sole cause of this particular rejection. [Play’s subscription policy](https://support.google.com/googleplay/android-developer/answer/9900533) explicitly identifies incompletely localized pricing/currency as a violation. This PR follows the USD-only ruling. **If rejection repeats, local pricing is the fallback and needs a separate owner decision.** Approval is not guaranteed. 2. **Ambiguous symbols:** confirmed in the original native simpleCurrency helpers, retention formatter, web Intl formatter, and backend bare-dollar output. A probe against the pinned intl package rendered $29.99 in en_US/en_CA/en_IN and 29,99 $ in de_DE; the shared formatter renders US$29.99 in all four. All current purchase displays now identify USD explicitly. 3. **Other surfaces:** confirmed v1 price_string consumption and missing post-trial amounts on both trial offers. At the fetched baseline, offer ARB values already used placeholders (including Try for {price}). The adjacent Plan & Usage chat-cost ARBs and widget did embed bare dollar signs; all three affected keys now consume formatted USD placeholders. The remaining dollar example in CTA metadata is removed. Legacy PricingOption.priceString stays wire-compatible and has no purchase-display reader. Stripe [manual currency selection](https://docs.stripe.com/payments/checkout/localize-prices/manual-currency-prices) can select presentment independently of Adaptive Pricing; explicitly setting session currency overrides that selection. [locale=auto](https://docs.stripe.com/api/checkout/sessions/create) follows browser language. Stripe controls glyphs, so a real cart may use US$, a dollar glyph with USD, or localized USD wording; its amount/currency must match. Hosted-cart visual verification is a release acceptance step, not established by mocked session assertions. ## Compatibility and rollout - Existing subscriptions, retained prices (including JPY), cancellation/reactivation, plan limits and Free benefits are unchanged. JPY manage paths display ¥ with whole-yen units; no new JPY checkout is enabled. - iOS uses the same Flutter prices and Stripe Checkout subscription flow. No StoreKit billing / in_app_purchase implementation exists. The in_app_review plugin does import StoreKit for review prompts only; that is unrelated to purchasing. - V2 raw-money/template fields are additive; installed clients retain their original rendered fields. Deploy the backend before the mobile build. The coordinator must separately publish web/paywall/index.html through its existing web-paywall release path. - This lane does not merge or deploy. Operator steps, including Codemagic build verification, Play Policy status / Inbox, review submission, note text, and the separate Play Payments-policy risk, are in the private run report play-resubmit-steps.md. ## Validation - Focused backend tests run only via backend/test.sh with a file selector and BACKEND_PYTEST_WORKERS=4; new tests cover new-buyer USD catalog selection across en_US/en_CA/en_IN/de_DE, selected session currency, manual-currency decoys, trial/promo/returning-customer paths, and retained JPY management. - Flutter widget tests cover the actual trial card, post-trial copy and exact checkout handoff across en_US/en_CA/en_IN/de_DE, outline/web bridge, 30-day upsell, plans, promo redemption, retention, v1/v2 JPY, and server-string poisoning. - Rendered production-widget PNG evidence is attached under [.agent-artifacts/ui-evidence/playcur](https://github.com/BasedHardware/omi/tree/d844a9ab98b2577189c0695899506b086191b1e3/.agent-artifacts/ui-evidence/playcur) (55 screenshots: 32 widget renders plus 23 native Android captures; all trial slides/cards, outline, upsell, v1/V2 plans/promo, retention, and v1/v2 JPY; en_US and en_CA). The native set was inspected with agent-flutter on Android API 36; the web PNGs use an emulator frame capture of offline static HTML. All use fixture data and are not hosted-cart acceptance. No production account access, GCP tier, live Stripe mutations, Cloud Logging reads or browser automation were used. - Repository localization check (`python3 app/scripts/l10n.py check`) reruns flutter gen-l10n and passes: 49 locales, 4298 keys. Strict ICU audit: all five message keys changed by this PR match English branches/placeholders exactly in every locale; zero newly introduced full-catalog mismatches. The full scan also identifies 184 pre-existing differences across six unrelated keys. Bare-dollar-before-placeholder scan: zero matches across all ARB values. Creator payout threshold copy is unchanged. - Luna independent review complete through d844a9a: no findings remain after resolving the V2 and Free-card formatter gaps; final test/evidence changes and the main merge were also reviewed. - make preflight: all 66 checks passed. PR metadata: all 5 checks passed. Latest Flutter render/storefront suite: 47 tests passed; corrected dark-palette captures visually inspected. Billing/usage follow-up: 58 tests passed, including capped/uncapped USD budgets in all four locales; four native Plan & Usage captures added. Initial CI found a stale checkout fixture missing the new Price-read mock; fixed with an HTTP-level currency assertion. Full Flutter CI on the earlier head had 7,871 passes and one stale annual-switch expectation; both related expectations are corrected. Final billing/handoff/usage regression: 76 passed. Exact-head CI at d844a9a is terminal green: 44 successful checks, 22 intentional skips, zero pending/failure/cancelled checks. Full Flutter suite: 7,890 passed, four skipped in 21:34. The first exact-head attempt hit the existing 30-minute job cap with no failed-test event; the same-head rerun passed without changing workflow limits or test selection. ## Product invariants affected none Failure-Class: new 
Summary
Google Play rejected Android production release 1504 (1.0.573) because the subscription price in the purchase flow differs between screens: the paywall shows the catalog's USD price, and Stripe Checkout, with the account's Adaptive Pricing on, charged non-US buyers a converted local-currency amount. Since then Play refuses every automated edit commit (
changesNotSentForReview) on every track, which blocks Android releases, including the pendant audio-drop fix already on main.This PR disables Stripe Adaptive Pricing on every subscription Checkout session (
adaptive_pricing: {enabled: false}), not only promo-code sessions (#23557 / #23299). Checkout now charges the price's own currency, which is the currency every paywall shows.Why this option, not localized paywall prices
backend/docs/storefront-contract.md). Once this is deployed, every installed Android build, the rejected 1504 included, shows and charges the same USD amount. No client change is needed. The new Android build from main is still needed to resubmit and to ship the audio fix.Trade-off: buyers outside the US pay in USD, so their card issuer may add a foreign-transaction fee, and Adaptive Pricing's conversion uplift is lost. Legacy JPY prices still charge JPY, because Checkout charges the price's own currency.
Rollback: revert this PR and deploy the backend. Rolling back restores the mismatch Play rejected, so don't do it while an Android release is in review.
Changes
backend/utils/stripe.py:adaptive_pricing: {enabled: false}moved from the promo branch into the base session params.backend/tests/unit/test_payment_promo_adaptive_pricing.py: tests that the pin is set on sessions with a promo code, without one, with a trial and for a returning customer, plus a static check that the pin is unconditional. This replaces the old assertion that promo-free sessions keep Adaptive Pricing.backend/docs/storefront-contract.md: states that checkout charges the currency the sheet shows.Verification
backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST=test_payment_promo_adaptive_pricing.py,test_payment_checkout_trial.py,test_payment_declined_proration.py,test_payment_promotion_codes.py: 33 passed, 0 failed (unit layer, Stripe mocked).Deploy
Backend only (the
backendCloud Run service serving/v1/payments/checkout-session). It has to be live in prod before the Android resubmission goes to review.Failure-Class: none
🤖 Generated with Claude Code