charanjit-singh/lovable-skills/stripe-payment-webhooks
- community
Checking that the SKILL.md file is still in the repository.
Use when implementing or fixing Stripe payment webhooks: signature verification, event handlers, syncing subscriptions or Checkout to Supabase, webhook endpoint setup. Not for pricing page UI only, non-Stripe providers, or generic edge functions without payment events (see edge-functions-and-webhooks).
Install
npx vskill@latest install charanjit-singh/lovable-skills/stripe-payment-webhooksSKILL.md
Stripe payment webhooks
Webhooks are the source of truth for paid state. Checkout success URLs and client callbacks are not sufficient alone.
Related: edge-functions-and-webhooks (hosting), payment-webhook-idempotency, payment-webhook-testing, payment-failed-and-recovery, pricing-and-billing.
Endpoint
- Supabase Edge Function:
supabase/functions/stripe-webhook/index.ts - Stripe Dashboard → Webhooks → endpoint URL → signing secret in
STRIPE_WEBHOOK_SECRET - Use raw body for signature verification (do not parse JSON first).
Return 2xx quickly after enqueue or DB write; Stripe retries on non-2xx.
Database (service role inside function)
Map user_id via client_reference_id on Checkout or metadata.user_id on Customer/Subscription.
Event handlers (subscriptions)
| Event | Action | |
|---|---|---|
checkout.session.completed | Read subscription or mode; link customer to user_id; upsert subscription row | |
customer.subscription.created | Upsert status, price_id, period end | |
customer.subscription.updated | Same; handle plan change, cancel_at_period_end | |
customer.subscription.deleted | Set status canceled; revoke entitlements | |
invoice.paid | Confirm period; optional receipt email | |
invoice.payment_failed | See payment-failed-and-recovery |
One-time payments
For mode: "payment" Checkout or Payment Links, handle:
checkout.session.completed(checkmode === "payment")payment_intent.succeeded
Store orders or purchases table; do not reuse subscription row without clear schema.
Metadata contract
Always set on Checkout Session creation (server or Stripe Dashboard template):
client_reference_id: Supabaseauth.users.idmetadata.user_id: same (backup)
Never trust webhook to grant access without resolving user from metadata you control at session creation.
Entitlements
After DB upsert, app reads subscriptions.status:
- Pro:
active,trialing - Not pro:
canceled,unpaid,past_due,incomplete, missing row
Avoid
- Skipping signature verification in production.
- Using Checkout
success_urlalone to setis_pro. - Logging full card or customer PII.
- 4xx on duplicate events (use idempotency — return 200 if already processed).
Checklist
- [ ] Raw body +
constructEvent/constructEventAsync - [ ]
stripe_webhook_eventsinsert before side effects - [ ] Service role client only inside function
- [ ] Test mode vs live mode secrets separated
Templates: examples.md.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/stripe-payment-webhooks/SKILL.md
Popularity
- Repository stars
- 10
- Repository forks
- 9
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/charanjit-singh/lovable-skills/stripe-payment-webhooks)