# WithListen

- Module: [CommunityToolkit.Aspire.Hosting.Stripe](/reference/api/go/communitytoolkit.aspire.hosting.stripe.md)
- Version: `13.6.1`
- Kind: `method`
- Defined on: [`StripeResource`](/reference/api/go/communitytoolkit.aspire.hosting.stripe/striperesource.md)
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/d9c2addac6f527ef2e33712d290b84574b455a3b)

Configures the Stripe CLI to listen for webhooks and forward them to the specified URL expression.

## Definition

```go
func (StripeResource) WithListen(
    forwardTo ResourceWithEndpoints,
    options ...*WithListenOptions,
) StripeResource
```

## Parameters

- `forwardTo` (`ResourceWithEndpoints`) -- The resource to forward webhooks to.
- `options` (`...*WithListenOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithListenOptions` argument.

- `WebhookPath` (`*string`) -- The path to the webhook endpoint.
- `Events` (`[]string`) -- Optional collection of specific webhook events to listen for (e.g., ["payment_intent.created", "charge.succeeded"]). If not specified, all events are forwarded.

## Returns

[`StripeResource`](/reference/api/go/communitytoolkit.aspire.hosting.stripe/striperesource.md) -- A reference to the `IResourceBuilder`.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`StripeResource`](/reference/api/go/communitytoolkit.aspire.hosting.stripe/striperesource.md)
