# `MishkaPay.Feature.Entitlement`
[🔗](https://github.com/mishka-group/mishka_pay/blob/v0.0.1/nofile#L1)

A customer's access to a `MishkaPay.Feature` right now, given by a product they bought, read
with `MishkaPay.list_entitlements/4`. A guarded_struct the provider fills in.

  * `:provider`, `:id`: the provider's id of the entitlement.
  * `:feature_id`: the feature it gives.
  * `:lookup_key`: the feature's lookup key, which the host checks access by.

The provider keeps the list current as subscriptions start and end, and sends a webhook when it
changes (`entitlements.active_entitlement_summary.updated` at Stripe).

# `t`

```elixir
@type t() :: %MishkaPay.Feature.Entitlement{
  feature_id: String.t() | nil,
  id: String.t() | nil,
  lookup_key: String.t() | nil,
  provider: String.t() | nil
}
```

The struct that `builder/1` returns.

| Field | Type | Required | Default | Description | Derives |
| --- | --- | --- | --- | --- | --- |
| `:provider` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:id` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:feature_id` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:lookup_key` | `String.t()` \| `nil` | no |  |  | `validate(string)` |

# `builder`

# `enforce_keys`

# `enforce_keys`

# `example`

A sample %MishkaPay.Feature.Entitlement{} populated from defaults + type-based fallbacks.

# `keys`

# `keys`

---

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