Repository navigation
feat(web): in-app Cap Pro checkout with Stripe Checkout elements - #3603
Merged
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Member
Author
|
hey @greptileai, please re-review the PR |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cap Pro checkout on the web now happens on Cap's own
/checkoutpage instead of redirecting to hosted Stripe Checkout. It is built on Checkout Sessions withui_mode: "elements"(Payment Element + Express Checkout Element), so Stripe still owns the session, Radar, 3DS, tax ID collection and promotion codes, and fulfilment still runs through the existingcheckout.session.completedwebhook.The page only turns on when
STRIPE_PUBLISHABLE_KEYis set. Without it, every route behaves exactly as onmain./checkout)Flow
sequenceDiagram participant B as Browser participant P as /checkout (RSC) participant A as createProCheckout participant S as Stripe participant W as /api/webhooks/stripe B->>P: Pricing "Get Pro" (router.push) P->>A: start session during render (not awaited) A->>S: checkout.sessions.create(ui_mode: elements, currency) P-->>B: page streams, client secret arrives as a promise B->>S: Payment Element / Apple Pay confirm (3DS if needed) S->>W: checkout.session.completed W->>W: find or create user, set Pro, link customer.metadata.userId S-->>B: return_url /checkout/completeChanges
apps/web/actions/billing/checkout.ts:69plan,seatsandonboarding.rl_guest_checkoutfirewall rate limit.subscription_data.billing_mode.type = "classic"(:130), because the existing seat-change previews on API 2023-10-16 reject flexible billing subscriptions.stripe-v23client (apps/web/lib/checkout/stripe.ts:10) since elements mode andcheckout.sessions.updateare not in stripe-node 14. The rest of the app stays on stripe-node 14.apps/web/actions/billing/checkout.ts:178apps/web/lib/visitor-country.ts:5x-vercel-ip-countrycomes from Vercel's edge (VERCEL=1, two-letter code), and only if both plan prices support it (apps/web/lib/checkout/plans.ts:50). Everything else is USD./api/currencyuses the same check.apps/web/actions/billing/current-plan.ts:64/checkoutshows the current plan and an owner-only "Add seats" flow (previewAddSeats/addSeats) that wraps the existing seat update path.subscribeandguest-checkoutreturn/checkout?plan=&seats=for web when enabled (apps/web/app/api/settings/billing/subscribe/route.ts:46). Desktop, mobile andhosted: truecallers keep hosted Checkout./checkoutand warm Stripe.js on pointer/touch/focus./checkoutis frame protected (apps/web/proxy.ts:47).apps/web/app/api/webhooks/stripe/route.ts:526session.metadata.dubCustomerIdwhen the Stripe customer has nouserIdmetadata and its email no longer matches the account.customer.metadata.userIdafter every completed checkout (:582), so latercustomer.subscription.updated/deletedevents find the user. Guests get exactly one customer update.apps/web/actions/organization/get-subscription-details.tsunit_amount, so the per-seat price is now derived from the tiers instead of showing$0.Rollout
STRIPE_PUBLISHABLE_KEYturns the page on; removing it and redeploying sends every buyer back to hosted Checkout, no code change needed.

Confidence Score: 5/5
The latest changes appear safe to merge; no new blocking issue was found.Summary
Adds in-app Cap Pro checkout, with hosted Stripe Checkout kept as a fallback.
All four earlier findings were rechecked. No new actionable issue was found in the latest changes.
Reviews (2) · Last reviewed commit: "fix(web): sign out before switching acco..." · Reviewed by Greptile