Payment Gates
This is where payments become real and secure. When a user pays, Stripe notifies your app via a webhook; you record their subscription in Neon, and you gate premium features by checking the signed-in user (Clerk) against what they've paid for. It ties together everything from this level.
Payments are a big, risky feature – like auth, you'll build it on a branch and test it on a Vercel preview before merging to main.
Payments are unforgiving, so let the skills own the correctness. You've installed the Stripe skill (Payment Provider lesson), and you already have the Clerk skill (auth) and Neon (via the Vercel plugin). If you're unsure the Stripe skill is active, ask Claude to reinstall it and start a new chat – then hand it your context before building.
1. Plan it on a branch
Start a branch for the payment work and plan the flow with Claude in plan mode.
Outcome: You're on a payment branch with a clear plan.
2. Build the webhook handler and Neon sync
The webhook is how your app learns who has paid. Build it carefully – verifying Stripe's signature is non-negotiable.
Outcome: When a subscription changes in Stripe, your Neon database stays in sync – securely.
3. Gate premium features
Now lock premium features to paying users. The check is always server-side: who is the user (Clerk), and are they subscribed (Neon)?
Outcome: Premium features are locked to paying users, enforced on the server.
4. Test the whole flow on your preview
Push the branch for a preview, point Stripe's test webhooks at it, and run the full loop.
Outcome: Your full payment system works on the preview in test mode – ready for the production cutover next lesson.