# `PolarExpress.Events.CustomerStateChanged`
[🔗](https://github.com/jeffhuen/polar_express/blob/main/lib/polar_express/events/customer_state_changed.ex#L2)

Webhook event for `customer.state_changed`.

Sent when a customer state has changed.

It's triggered when:

* Customer is created, updated or deleted.
* A subscription is created or updated.
* A benefit is granted or revoked.

**Discord & Slack support:** Basic

The `data` field contains a `PolarExpress.Schemas.CustomerState` struct.

# `t`

```elixir
@type t() :: %PolarExpress.Events.CustomerStateChanged{
  data: PolarExpress.Schemas.CustomerState.t(),
  timestamp: String.t(),
  type: String.t()
}
```

* `type` - Always `"customer.state_changed"`.
* `data` - The event payload. See `PolarExpress.Schemas.CustomerState`.
* `timestamp` - ISO 8601 timestamp of when the event occurred.

# `event_type`

```elixir
@spec event_type() :: String.t()
```

Returns the event type string.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
