Skip to content

fix: restore embedded Stripe checkout - #8284

Merged
alx-xo merged 7 commits into
mainfrom
fix/restore-embedded-stripe-checkout
Oct 30, 2026
Merged

alx-xo merged 7 commits into
mainfrom
fix/restore-embedded-stripe-checkout

Conversation

@alx-xo

@alx-xo alx-xo commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

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

  1. 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.
  2. Open Billing, start checkout, and verify the embedded form renders on Billing setup.
  3. Complete sandbox checkout and verify webhook-driven subscription activation and the Payment method view.
  4. 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_KEY configuration that mounts the embedded form, with provisioning in stripe:setup and 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-js to 7.0.0 and @stripe/stripe-js to 10.1.0.

Release prerequisites

  • Deploy speakeasy-api/gram-infra#4827 to supply STRIPE_PUBLISHABLE_KEY and verify it syncs to server pods before rollout.
  • Subscribe existing Stripe webhook endpoints to checkout.session.async_payment_succeeded and checkout.session.async_payment_failed.
  • Coordinate server and dashboard rollout since the checkout response contract changes from a URL to client secret and publishable key.

Written for commit aa02e55. Summary will update on new commits.

View guided diff Turn on auto-fix

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

@alx-xo alx-xo added the bug Something isn't working label Oct 29, 2026
@changeset-bot

changeset-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: aa02e55

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
server Minor
dashboard Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 99 files

This PR changes payment, billing, or quota logic. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread server/cmd/gram/deps.go Outdated
Comment thread client/dashboard/src/components/billing/use-billing-state.ts
Comment thread client/dashboard/src/lib/billing-recovery-path.ts
Comment thread client/dashboard/src/contexts/AuthProvider.test.tsx
Comment thread .mise-tasks/stripe/_listen.mts
Comment thread client/dashboard/src/components/billing/payg-checkout-summary.tsx Outdated
Comment thread client/dashboard/src/components/billing/payg-price-list.tsx Outdated
Comment thread server/internal/thirdparty/stripe/client.go Outdated
Comment thread server/internal/usage/stripe_webhook.go Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 22 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread server/cmd/gram/deps.go
Comment thread client/dashboard/src/pages/billing/BillingSetup.test.tsx
@alx-xo
alx-xo marked this pull request as ready for review October 29, 2026 21:49
@alx-xo
alx-xo requested review from a team as code owners October 29, 2026 21:49
@github-actions github-actions Bot added the preview Spawn a preview environment label Oct 29, 2026
@blacksmith-sh

This comment has been minimized.

@alx-xo
alx-xo force-pushed the fix/restore-embedded-stripe-checkout branch from 6587727 to 4e6ca24 Compare October 29, 2026 22:07
@alx-xo alx-xo added preview Spawn a preview environment review:bypass Merge without human review approval. Required status checks still apply. and removed preview Spawn a preview environment labels Oct 30, 2026

@gram-bot gram-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: review:bypass label applied by @alx-xo. Required status checks still gate this merge.

@alx-xo
alx-xo enabled auto-merge October 30, 2026 01:30
@alx-xo
alx-xo added this pull request to the merge queue Oct 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 30, 2026
@alx-xo
alx-xo added this pull request to the merge queue Oct 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 30, 2026
@alx-xo
alx-xo added this pull request to the merge queue Oct 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 30, 2026
@alx-xo
alx-xo force-pushed the fix/restore-embedded-stripe-checkout branch from 4e6ca24 to 9c2d8db Compare October 30, 2026 04:15
@alx-xo
alx-xo enabled auto-merge October 30, 2026 04:19
@blacksmith-sh

This comment has been minimized.

@alx-xo
alx-xo added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 5f42247 Oct 30, 2026
52 of 54 checks passed
@alx-xo
alx-xo deleted the fix/restore-embedded-stripe-checkout branch October 30, 2026 04:37
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working preview Spawn a preview environment review:bypass Merge without human review approval. Required status checks still apply.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant