# Send webhooks and simulate failures

Use Lookalyke to send a signed event to your app on demand. Webhooks run from the Lookalyke server to your app’s handler.

## Send a Stripe webhook

1. Start the [demo sandbox](https://lookalyke.dev/docs/quickstart/#start-the-demo) so Stripe has sample invoices. Run your app’s webhook handler locally, for example at `http://127.0.0.1:8787/api/webhooks/stripe`.
2. Open **Stripe → Connect** or use **Setup** to set that destination. Set your app’s development `STRIPE_WEBHOOK_SECRET` to the sandbox secret shown there. Keep signature verification on and verify the raw request body.
3. In **Activity**, use **Make something happen → A card payment goes through**. You can also trigger that payment from the checkout.

```sh
node packages/server/dist/cli.js trigger stripe payment.succeeded
```

Open the delivery in **Activity**. Check the event type, destination, and your handler’s response. A successful payment can emit multiple events. A handler that only processes one type should still acknowledge events it recognizes but does not act on.

## Test a failure

Use **Break things** to slow an API response, return an error, or drop a connection. For example, make Stripe return HTTP 429 and verify that your app responds the way you expect.

```sh
node packages/server/dist/cli.js break stripe errors 429
```

Set Stripe back to normal when the test ends.

```sh
node packages/server/dist/cli.js break stripe normal
```

To test the business case where a card is declined, use **A card is declined** in **Make something happen** or run `node packages/server/dist/cli.js trigger stripe payment.declined`. That is a payment outcome your app should handle differently from an unavailable service.

## Inspect and retry a delivery

Lookalyke records failed attempts in **Activity**. Open the event to see whether your handler returned an error, Lookalyke could not reach it, or the destination was refused. The default retry schedule is 1 minute, 5 minutes, 30 minutes, and 2 hours. Use **Send again** when you want to try immediately after fixing the handler.

A loopback Lookalyke instance can send webhooks to a handler on the same machine. For Docker or Railway, `localhost` means the container. Use the address reachable from Lookalyke and add it to the allowed webhook hosts. [See the hosting guide](https://lookalyke.dev/docs/hosting/).
