## listen

Receive webhook events from Stripe on your local machine via a direct connection to Stripe's API. The `listen` command can receive events based on your account's default API version or the latest version, filter by type of event, or forward events to an application running on a given port.

By default, `listen` accepts all snapshot webhook events and displays them in
your terminal. In order to listen to thin events, you must pass them in via `--thin-events`.

> You don't need to configure any webhook endpoints in your Dashboard to receive webhooks with the CLI.
> 
> The webhook signing secret provided will not change between restarts to the `listen` command.

**Command:** `stripe listen`

### Flags

- `-e, --events <events types>`
  A comma-separated list of which snapshot events to listen for. The [event types documentation](https://docs.stripe.com/api/events/types.md) includes a complete list (default: `[*]` for all events).

- `-f, --forward-to <url>`
  The URL that snapshot webhook events will be forwarded to. Returns a [webhook signing secret](https://docs.stripe.com/webhooks/signatures.md) which you can add to your application's configuration.

- `-H, --headers <values>`
  A comma-separated list of custom HTTP headers to forward.

Ex: `"Key1:Value1, Key2:Value2"`

- `-c, --forward-connect-to <url>`
  The URL that Connect webhook events will be forwarded to. By default, the same URL will be used for all snapshot webhook events.

- `--connect-headers <values>`
  A comma-separated list of custom HTTP headers to forward to any connected accounts. This is useful when testing a [Connect](https://docs.stripe.com/connect.md) platform.

Ex: `"Key1:Value1, Key2:Value2"`

- `--thin-events <events types>`
  A comma-separated list of which thin events to listen for. The [event types documentation](https://docs.stripe.com/api/v2/core/events/event-types.md) includes a complete list. Use `*` for all events. (default: none).

- `--forward-thin-to <url>`
  The URL that thin webhook events will be forwarded to. Returns a [webhook signing secret](https://docs.stripe.com/webhooks/signatures.md) which you can add to your application's configuration.

- `--forward-thin-connect-to <url>`
  The URL that thin Connect webhook events will be forwarded to. By default, the same URL will be used for all thin webhook events.

- `-l, --latest`
  Receive events used in the latest API version. By default, webhook events received will depend on your account's default API version.

- `--live`
  Make a live request (by default, runs in test mode).

- `-a, --load-from-webhooks-api`
  Listen for all webhook events based on your existing webhook endpoints configured in the Dashboard and API.

- `-j, --print-json`
  Print JSON objects to stdout.

- `--print-secret`
  Only print the webhook signing secret and exit.

- `--skip-verify`
  Skip certificate verification when forwarding to HTTPS endpoints.

### Examples

**Basic usage**

```sh
stripe listen
```

```
> Ready! Your webhook signing secret is whsec_abcdefg1234567
2022-01-28 09:47:46   --> customer.created [evt_abc123]
2022-01-28 09:48:22   --> charge.succeeded [evt_def456]
2022-01-28 09:48:58   --> charge.succeeded [evt_ghi789]
```

**Forward webhook events to an application**

```sh
stripe listen --forward-to http://localhost:4242
```

**Filter webhook events by type**

```sh
stripe listen --events=payment_intent.succeeded
```
