Stripe webhook testing

From ahtavarasmus/lightfriend · View interactive version

Stripe webhook testing is an AI agent skill from the GitHub repository ahtavarasmus/lightfriend. Set up Stripe CLI to forward webhooks to local development server for testing Stripe integrations

How to use this skill

Skill file

Stripe Webhook Testing Skill

This skill should be used when the user wants to test Stripe webhooks locally during development.

Prerequisites

Setup Process

Step 1: Ensure Webhook Endpoint Exists

The backend must have a webhook endpoint at /api/stripe/webhook. Verify this in:

Step 2: Start Backend Server

Ensure the backend is running:

cd backend && cargo run

The server must be running before starting Stripe CLI forwarding.

Step 3: Start Stripe CLI Forwarding

Run the following command to forward webhooks to localhost:

stripe listen --forward-to localhost:3000/api/stripe/webhook

The CLI will output a webhook secret starting with whsec_....

Step 4: Configure Webhook Secret

  1. Copy the webhook secret from the CLI output
  2. Add or update STRIPE_WEBHOOK_SECRET in backend/.env:

```

STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxx

```

  1. Restart the backend server to pick up the new secret

Step 5: Trigger Test Events

Use Stripe CLI to trigger test webhook events:

# Subscription events
stripe trigger customer.subscription.created
stripe trigger customer.subscription.updated
stripe trigger customer.subscription.deleted

# Checkout events
stripe trigger checkout.session.completed

# Invoice events
stripe trigger invoice.paid
stripe trigger invoice.payment_failed

Step 6: Verify in Logs

Check backend console output for:

Supported Webhook Events

The backend currently handles:

Troubleshooting

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.