Repository navigation
Glint Pro billing on Stripe Checkout with Managed Payments - #36
Merged
Merged
Conversation
Four new ops on the account function: checkout, confirm (back from checkout), portal and webhook. The webhook uses only the event id, re-reads the event and the subscription from Stripe and stores Stripe's current state, so it needs no signing secret. The account panel shows Upgrade and Manage billing when billing is on, and handles the return from checkout. Billing stays off until STRIPE_SECRET_KEY and STRIPE_PRICE_ID are set; until then the panel keeps the waitlist link. Privacy and terms pages describe the payment handling. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016tciSRcwDsHcLgxbSDvQgC
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What this adds
Billing for Glint Pro, on Stripe Checkout with Managed Payments (Stripe sells as the merchant of record and handles tax). It is off until the deployment has
STRIPE_SECRET_KEYandSTRIPE_PRICE_ID; until then nothing changes for visitors and the account panel keeps its waitlist link.api/_billing.js(new): four ops on the one account function, so no new serverless functioncheckout: starts a subscription checkout for the signed-in personconfirm: back from checkout, reads the session from Stripe (only for the person who started it) so the plan is right at onceportal: Stripe's billing portal (cancel, change card, receipts)webhook: takes only the event id, re-reads the event and then the subscription from Stripe with our key, and stores Stripe's current state. No signing secret and no raw body are needed, and a forged or replayed call can at most re-read a real subscriptionactive/trialingsubscriptions keep a period end, so an unpaid or ended one is Free at once; news about an older subscription never overwrites a live newer one?pro=success&session_id=return and cleans the addressmereportsbilling,priceLabeland whether there is a subscription to managepro_checkout(start / done) is listed on the privacy pageCLAUDE.md,docs/BACKEND.md(settings),docs/GLINT-PRO-STATUS.md(how to switch it on)Plain HTTPS to Stripe, no new dependency.
Testing
npm run checkpasses. NewtestBillingRoutesruns every route against a stand-in Stripe: checkout parameters, a stranger cannot claim someone else's checkout, a forged webhook body changes nothing, past due and cancelled drop to Free, resubscribing reuses the customer, late news about an old subscription is ignored, Stripe being down answers 502managed_paymentsGenerated by Claude Code