plan gallery · webhook
Stripe → Supabase → Resend
Webhook ordering across payment events and transactional email.
Architecture
- 01stripeinvoice.paid or checkout.session.completed arrives
- 02supabaseidempotent upsert of billing state
- 03resendreceipt / welcome email after the row commits
Env-var matrix
Security checklist
- verify stripe signature before any writeemail + db writes from forged events are expensive
- dedupe on event.idstripe retries the same event
- send email only after upsert succeedsotherwise you email for a row that never landed
Folders
· src/webhooks/stripe.ts · src/email/receipt.ts · src/lib/idempotency.ts