fix: restore embedded Stripe checkout
Merged
AL
4h ago+9207+9207+0123456789012345678901234567890123456789-1736-1736-0123456789012345678901234567890123456789
Summary
- Revert #8257 (94d980e5a1f28f9c2427e684657ff7d368aed9f9), restoring the embedded Stripe checkout work from #7459.
- Preserve subsequent main-branch changes; the restoration applied without conflicts and its stable patch ID matches the inverse of the revert.
Motivation
Restore embedded checkout after provisioning its missing deployment configuration. Keep this PR in draft until the configuration prerequisites and rollout validation are complete.
Release prerequisites
- Merge and deploy speakeasy-api/gram-infra#4827 for cloud staging (dev) and production.
- Verify ExternalSecret synchronization and the publishable key's presence in running server pods without exposing its value; verify account/mode matches the existing Stripe API key.
- Subscribe the existing Stripe webhook endpoints to checkout.session.async_payment_succeeded and checkout.session.async_payment_failed, preserving existing events.
- Coordinate server and dashboard rollout: the checkout response contract changes, and a shared release tag does not guarantee an atomic rollout. Resolve mixed-version handling or gate checkout during deployment.
- Verify checkout end to end in staging before production promotion.
Validation
mise run test:server ./internal/thirdparty/stripe/: 147 tests passed.- Diff checks and commit hooks passed.
- End-to-end checkout verification is still pending.
Gutternote review steps
- Use an org-admin account in a sandbox organization with self-serve billing enabled and no active subscription. Ensure the preview has matching Stripe keys.
- Open Billing, start checkout, and verify the embedded form renders on Billing setup.
- Complete sandbox checkout and verify webhook-driven subscription activation and the Payment method view.
- Verify redirect/cancel recovery and delayed-payment handling where supported.
Summary by cubic
Restores embedded Stripe Checkout for pay-as-you-go billing, replacing the hosted Checkout page with an inline form on the dashboard.
- Adds the checkout session status endpoint and
STRIPE_PUBLISHABLE_KEYconfiguration that mounts the embedded form, with provisioning instripe:setupand startup validation that the key's format and test/live mode match the API key. - Adds Billing setup and Payment method pages with recovery handling for locked-out organizations returning mid-checkout, and expires stale or superseded sessions instead of replaying them.
- Subscribes webhooks to async payment success/failure events, validates checkout sessions against remote Stripe state, and upgrades
@stripe/react-stripe-jsto 7.0.0 and@stripe/stripe-jsto 10.1.0.
Release prerequisites
- Deploy
speakeasy-api/gram-infra#4827to supplySTRIPE_PUBLISHABLE_KEYand verify it syncs to server pods before rollout. - Subscribe existing Stripe webhook endpoints to
checkout.session.async_payment_succeededandcheckout.session.async_payment_failed. - Coordinate server and dashboard rollout since the checkout response contract changes from a URL to client secret and publishable key.
Review follow-up
- Recommended fixes:
131ed234d7— publishable-key validation, bounded confirmation/retries, transient error classification, and trailing-slash recovery. - Selected optional improvements:
b5cfd4edc2— recovery URL assertions, currency/heading/copy polish, research clarification, and webhook/documentation cleanup. - The pre-existing organization command-palette permission issue is explicitly deferred; no palette permission changes are included.
- Full dashboard suite: 8,677 tests passed across 781 files. Dashboard type-check passed.
- Full Stripe and usage suites: 572 tests passed; the later backend test-structure refactor passed all 17 focused tests.
- Both commits passed pre-commit checks. Live Stripe checkout and deployment verification remain pending.
🚀 Preview Environment (PR #8284)
Preview URL: https://pr-8284.dev.getgram.ai
| Component | Status | Details | Updated (UTC) |
|---|---|---|---|
| ✅ Database | Ready | Existing database reused | 2026-10-30 04:24:54. |
| ✅ Images | Available | Container images ready | 2026-10-30 04:27:20. |
Gram Preview Bot