We wanted a dead-simple payment flow: click "Subscribe to Pro", pay $7.99, and immediately unlock AI features. Here's how we wired it up.
Stripe Payment Links
Instead of building a custom checkout form, we used Stripe Payment Links. They're hosted by Stripe, PCI-compliant out of the box, and take about 30 seconds to set up. We pass the user's email and Firebase UID as URL parameters so we can link the payment back to their account.
The webhook
When a payment completes, Stripe sends a webhook to our Netlify serverless function at /.netlify/functions/stripe-webhook. The function:
client_reference_id (the user's Firebase UID)subscription.plan = "pro" and an expiration dateEnvironment variables
All secrets (Stripe key, webhook secret, Firebase service account) live in Netlify environment variables — never in source code. The serverless function reads them at runtime.
The user experience
From the user's perspective:
Total implementation time: about 2 hours. Stripe's developer experience is genuinely excellent.