Repository navigation
feat: migrate hosted checkout to embedded form - #7459
Conversation
🦋 Changeset detectedLatest commit: 775b80c The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
There was a problem hiding this comment.
All reported issues were addressed across 36 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
There was a problem hiding this comment.
All reported issues were addressed across 10 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
1ab8083 to
c475c85
Compare
This comment has been minimized.
This comment has been minimized.
1e99604 to
229d717
Compare
There was a problem hiding this comment.
All reported issues were addressed across 36 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
View guided diff | Turn on auto-fix | Re-trigger cubic
84390ef to
6c1344a
Compare
Add dedicated billing setup and payment-method pages with themed Stripe forms, order summaries, and promotion-code support. Add organization-scoped checkout status lookup, redirect recovery, session replacement, and delayed-payment webhook handling. Update Stripe credential setup and generated API clients. Add lifecycle, authorization, promotion, and migration tests using real React Query flows and Stripe boundary stubs.
e90e56a to
775b80c
Compare
GRW-79
Summary
ui_mode: "form") on a dedicated Billing setup page, with a themed payment form, order summary, and promotion-code entry.Deploy the server and dashboard together:
createStripeCheckoutnow returns a client secret and publishable key. ConfigureSTRIPE_PUBLISHABLE_KEYfrom the same Stripe account asSTRIPE_API_KEY, and subscribe the webhook endpoint tocheckout.session.async_payment_succeededandcheckout.session.async_payment_failedalongside its existing events.Motivation
Collect payment details inside the dashboard and give billing setup a dedicated page. Keep existing promotion and subscription behavior while recovering canceled redirects and earlier hosted sessions through the same checkout lifecycle.
Gutternote review steps
gram-payg-self-serve-billingfor a sandbox organization with an active trial or an unsubscribed Free/Base account, and sign in as an org admin. Configure the preview's matching Stripe secret/publishable keys and webhook delivery. The seeded demo does not enable this flag itself./<org>/billing) and select Billing setup, or click Add payment method from the trial card. Expect the dedicated setup page (/<org>/billing/setup) with an order summary and Stripe form. Check light/dark themes, a narrow viewport, and promotion-code entry; an accepted partner promotion should be pre-applied./<org>/billing/payment-method) after backend subscription confirmation. A delayed payment remains in the processing state until confirmed.Linear Issue: GRW-79
Summary by cubic
Migrates hosted Stripe Checkout to the embedded form so pay-as-you-go setup starts inside the dashboard. The checkout endpoint now returns a client secret and publishable key that mount Stripe's form on a dedicated Billing setup page instead of redirecting to hosted Checkout.
STRIPE_PUBLISHABLE_KEYpaired withSTRIPE_API_KEY;mise run stripe:setupsaves the CLI publishable key only when it also uses the CLI secret, never next to an env-providedSTRIPE_API_KEY.themequery parameter while existing sessions keep their original appearance.checkout.session.async_payment_succeededandcheckout.session.async_payment_failedalongside the existing events.@stripe/react-stripe-js7.0.0 and@stripe/stripe-js10.1.0 for the embedded form while preserving legacy versions for@polar-sh/checkoutviapackageExtensions.Migration
createStripeCheckoutnow returns a client secret and publishable key.STRIPE_PUBLISHABLE_KEYfrom the same Stripe account asSTRIPE_API_KEY, and subscribe the webhook to the two async-payment checkout events.Written for commit 775b80c. Summary will update on new commits.
Screenshots
Billing setup
Payment method
Platform MCP assessment
Decision: intentionally omit new or changed Platform MCP tools for this checkout migration. The outcome is an organization administrator completing billing setup or updating a payment method for the explicitly selected active organization, not a project-scoped management operation. The existing Platform MCP tool catalogue and registration have no billing/subscription checkout tool to update; this does not change existing tool contracts, server instructions, or shipped workflows.
BillingSetup.tsxcontains the scope gates and organization-keyed checkout lifecycle;stripe_checkout_status.goenforces organization/customer ownership, with admin/read and foreign-session cases instripe_checkout_status_test.go.platformmcp/descriptor.godistinguishes external OAuth from project-assistant audiences. The browser review steps above cover payment entry, organization-admin access, redirect recovery, and confirmation. This records the intended design and inspected code/tests, not a claim that new browser checks were run or that the locally rebased changes have been pushed.🚀 Preview Environment (PR #7459)
Preview URL: https://pr-7459.dev.getgram.ai
Gram Preview Bot