Native store clients — architecture & commerce design
Version: 1.0
Last Updated: 2026-08-06 13:33:14
Status: Approved commercial posture (product owner direction 2026-08-06); engineering Deferred until roadmap trigger
Canonical REQs: 02-REQUIREMENTS.md §7.36 REQ-NATIVE-01…12
Architecture: 01-ARCHITECTURE.md — Native app strategy
Roadmap: 04-ROADMAP.md §13
Regulatory: 26-REGULATORY §2 App Store / Play
1. Problem
Section titled “1. Problem”LynCareOS is a multi-tenant family support care SaaS delivered today as a React PWA at app.lyncareos.com, with Stripe Checkout / Customer Portal as the commerce path. Product wants Google Play first, then Apple App Store, plus a Windows client option — without rewriting the SPA, without paying store commissions on the primary subscription, and without failing store payments policy review.
Gaps in prior docs (before this design):
- REQ-NATIVE covered Capacitor/push/HealthKit but not the commercial / payments-policy posture.
- Roadmap listed Capacitor as Deferred with no phased Play → Apple → optional store billing sequence.
- Auth (HttpOnly cookies vs Capacitor origin) and “free download without subscription” onboarding were underspecified.
2. Goals
Section titled “2. Goals”| Goal | Success |
|---|---|
| Store presence | Free LynCareOS clients on Google Play (first) and Apple App Store (second); Windows installer from website |
| Commerce SoT | All subscribe / upgrade / Care Profile purchase / billing portal stay on website + Stripe; tenant module flags unlock for the whole care circle |
| Play compliance | Android binary is consumption-only — no Stripe Checkout / payment portal deep links from the store build |
| No rewrite | Capacitor wraps existing React/Vite SPA; FastAPI API unchanged |
| Onboarding | Free store download always installs; free account or login works; paid modules gated by existing entitlements |
| Preserve path | Optional later Play Billing / StoreKit dual-rail only with explicit product-owner sign-off |
Non-goals (this design)
Section titled “Non-goals (this design)”- React Native rewrite (REQ-NATIVE-07 gate only).
- Implementing Capacitor in this change set (docs alignment only).
- GetQwikShop / shopping-standalone store billing (separate product; may use StoreKit/Play Billing — not this posture).
- HealthKit / Health Connect (post native shell; REQ-NATIVE-05).
3. Approaches considered
Section titled “3. Approaches considered”A — Consumption-only store clients + website Stripe (recommended)
Section titled “A — Consumption-only store clients + website Stripe (recommended)”Free store listings; app = login + use; buy on lyncareos.com.
Pros: Highest Play approval odds; 0% Google/Apple cut on web subscriptions; reuses existing entitlement model; Apple phase 1 can mirror.
Cons: In-app upgrade conversion lower; upgrade copy must avoid payment deep links in store builds.
B — Play Billing / StoreKit for tiers (dual entitlement)
Section titled “B — Play Billing / StoreKit for tiers (dual entitlement)”In-app buy via store rails; sync SKUs to tenant modules; keep Stripe for web.
Pros: In-app conversion.
Cons: ~15% Play effective fee on subscriptions (service + billing fee where published); dual entitlement complexity; not needed for first launch.
C — Billing Choice / external link programs (Stripe in-app with Google fee)
Section titled “C — Billing Choice / external link programs (Stripe in-app with Google fee)”Enroll in Google programs; user chooses Play or Stripe; report transactions.
Pros: Keep Stripe UX in some flows.
Cons: Still pay Google service fees; API/UX complexity; overkill for v1.
Decision: A for Play v1 and Apple v1. B/C only if measured conversion loss justifies them (REQ-NATIVE-12).
4. Commerce & entitlement model
Section titled “4. Commerce & entitlement model”| Surface | May initiate payment? | Entitlement source |
|---|---|---|
| Marketing + app in browser | Yes — Stripe | Webhooks → DB |
| Android / iOS store binary | No — consumption-only | Read API / module gates |
| Windows installer | Prefer website for pay; no Play/Apple fee | Same DB |
| Email / listing / help centre | Yes — may link to website checkout | Same |
Tenant rule (unchanged): Administrator purchases on the website → flags/modules on the tenant → all members with appropriate roles see unlocked modules. No per-device licence.
5. Client delivery matrix
Section titled “5. Client delivery matrix”| Client | Distribution | Binary price | Billing UI |
|---|---|---|---|
| Web / PWA | app.lyncareos.com | N/A | Full Stripe |
| Android | Google Play (free) | Free | Hidden / informational only |
| iOS | Apple App Store (free) | Free | Hidden / informational only |
| Windows | Direct download from website (MS Store optional later) | Free download | Website |
Post-purchase “Get the apps” page (website): after signup or subscribe, offer Windows installer, Play Store link, App Store link, and “Continue in browser.” iOS cannot be a public .ipa hosted on the site — App Store link only.
6. Store-build UX rules (Play & Apple v1)
Section titled “6. Store-build UX rules (Play & Apple v1)”Detect Capacitor / store build (Capacitor.isNativePlatform() or build flag).
| Allowed | Forbidden in store binary |
|---|---|
| Login, register free account, use entitled modules | Stripe Checkout Session open / redirect |
| Read-only plan status (“You’re on Complete”) | Customer Portal link that accepts payment |
| Informational copy without checkout URL: e.g. “Go to lyncareos.com to upgrade” (Play FAQ pattern) | “Upgrade now” → payment URL / WebView checkout |
| ModuleGate locked empty states | Care Profile “Buy once” in-app |
| Privacy policy / help (non-payment) | Any CTA that leads to an alternate payment method |
Free download without subscription: app installs and opens → sign in or create free account → free/starter surface + locked paid modules → website upgrade path (informational). Never require prior purchase to install.
Reviewer access: Play/App Store demo credentials with a seeded tenant.
7. Technical architecture
Section titled “7. Technical architecture”7.1 Shell
Section titled “7.1 Shell”Capacitor wraps Vite dist/ → Android .aab / iOS .ipa (REQ-NATIVE-02). Backend unchanged. Preserve REQ-NATIVE-06 rules ongoing.
7.2 Auth (must design before ship)
Section titled “7.2 Auth (must design before ship)”Refresh tokens are HttpOnly cookies scoped to the web origin. Capacitor bundled origins (capacitor:// / https://localhost) do not share those cookies.
Target approaches (choose at implementation plan):
- Preferred for v1 simplicity: Capacitor
server.url/ live-load againsthttps://app.lyncareos.comso cookie domain matches production (wrapper around live SPA), or - Bundled assets + API: extend
tokenStore/ session so native builds use a Capacitor-safe secure store for refresh (Keychain/Keystore via Preferences or dedicated plugin) and Bearer access tokens — still no PHI in logs.
Google OAuth: do not rely on in-WebView OAuth alone; use system browser / Capacitor Browser / ASWebAuthenticationSession pattern (existing GoogleSignInButton already notes WebView isolation).
7.3 Native capabilities (phased)
Section titled “7.3 Native capabilities (phased)”| Phase | Capability |
|---|---|
| Play v1 | Shell, auth, consumption-only commerce gating, camera for script capture if needed |
| Play v1.1 | Optional APNs/FCM mirror of care_alerts (REQ-NATIVE-03) |
| Apple v1 | Same as Play v1 posture |
| Later | HealthKit / Health Connect (REQ-NATIVE-05); store billing dual-rail (REQ-NATIVE-12) |
7.4 Service worker
Section titled “7.4 Service worker”Native builds must not fight Capacitor with the web SW cache strategy; disable or no-op SW registration when Capacitor.isNativePlatform().
8. Listing & regulatory
Section titled “8. Listing & regulatory”- Category: Health & Fitness / family support — not a medical app (REQ-NATIVE-04, doc 26).
- Privacy policy URL required; Data Safety / App Privacy nutrition labels when submitting.
- No diagnose / treat / cure claims in listing or store UI.
9. Roadmap phases (authoritative sequencing in 04 §13)
Section titled “9. Roadmap phases (authoritative sequencing in 04 §13)”| Phase | ID | Deliverable | Status |
|---|---|---|---|
| N0 | Docs | This design + REQ-NATIVE-08…12 + architecture/roadmap alignment | This change |
| N1 | Play v1 | Capacitor Android, consumption-only, free listing, reviewer login | Deferred |
| N2 | Website | Post-purchase / account “Get the apps” chooser (Win / Android / iOS / web) | Deferred (can ship web page before native) |
| N3 | Push | Optional native push mirror | Deferred |
| N4 | Apple v1 | Capacitor iOS, same commerce posture | Deferred after Play stable |
| N5 | Optional | Play Billing / StoreKit dual-rail — PO sign-off only | Deferred |
Trigger to start N1 remains REQ-NATIVE-01 (or earlier PO override).
10. Fee reference (context, not a commitment to use)
Section titled “10. Fee reference (context, not a commitment to use)”Using Google Play Billing for auto-renewing subscriptions: ~10% service + 5% billing fee ≈ 15% in US/UK/EEA under the 2026 fee model (Play Console — lower service fees). Website Stripe path under consumption-only: 0% Google/Apple cut on that revenue.
11. Open implementation decisions (for the future plan, not blockers for this design)
Section titled “11. Open implementation decisions (for the future plan, not blockers for this design)”- Live-load vs bundled assets for Capacitor auth.
- Exact feature-flag API for “store build hides billing routes.”
- Whether free-tier signup is in-app vs website-first (both policy-safe; product preference).
- Windows packaging technology (MSI/MSIX/Electron/PWA wrapper) — out of Capacitor scope.
12. Spec self-review
Section titled “12. Spec self-review”| Check | Result |
|---|---|
| Placeholders / TBD | Open items listed in §11 only; commerce decision closed |
| Consistency | Matches REQ-NATIVE-08…12 and architecture § Native |
| Scope | Docs + REQ alignment; no Capacitor scaffold in this change |
| Ambiguity | “Upgrade reference” = informational copy, not payment deep link |
13. Related documents to keep aligned
Section titled “13. Related documents to keep aligned”| Doc | Role |
|---|---|
| 02-REQUIREMENTS §7.36 | REQ-NATIVE-* |
| 01-ARCHITECTURE native section | Technical target |
| 04-ROADMAP §13 | Phase status |
| 31 reconciliation NATIVE | Delivery register |
| 05 billing index | Commerce pointer |
| 26 regulatory | Store listing candidate |