Skip to content

Glint Pro billing on Stripe Checkout with Managed Payments - #36

Merged
I-794 merged 1 commit into
mainfrom
claude/practical-archimedes-s2nxsa
Nov 15, 2026
Merged

I-794 merged 1 commit into
mainfrom
claude/practical-archimedes-s2nxsa

Conversation

@I-794

@I-794 I-794 commented Nov 15, 2026

Copy link
Copy Markdown
Owner

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_KEY and STRIPE_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 function
    • checkout: starts a subscription checkout for the signed-in person
    • confirm: back from checkout, reads the session from Stripe (only for the person who started it) so the plan is right at once
    • portal: 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 subscription
  • Only active / trialing subscriptions 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
  • Account panel: "Upgrade to Glint Pro" (with the price) and "Manage billing"; handles the ?pro=success&session_id= return and cleans the address
  • me reports billing, priceLabel and whether there is a subscription to manage
  • Privacy and terms pages describe the payment handling; new analytics event pro_checkout (start / done) is listed on the privacy page
  • Docs: CLAUDE.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 check passes. New testBillingRoutes runs 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 502
  • The new SQL was run on a local Postgres 16 with the credits function (active, past due, cancelled, resubscribed)
  • Browser run with a stand-in sign-in and mocked routes: upgrade hand-off, failed checkout, return as Pro, payment pending, cancelled checkout, signed out
  • Not yet run against real Stripe. The first sandbox run is the real test, including whether the pinned API version accepts managed_payments

Generated by Claude Code

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
@vercel

vercel Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
glint Ready Ready Preview Nov 15, 2026 11:51pm UTC

@I-794
I-794 merged commit 30ef2b2 into main Nov 15, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 6d5313d5 Deployed Nov 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants