# `MishkaPay.ApplicationFee`
[🔗](https://github.com/mishka-group/mishka_pay/blob/v0.0.1/lib/mishka_pay/application_fee.ex#L5)

The platform's cut of a sale made for a connected account (an application fee, `fee_...` at
Stripe): what a checkout's `:application_fee` or `:application_fee_percent` took. Read with
`MishkaPay.fetch_application_fee/3` and `MishkaPay.list_application_fees/3`, and given back to
the seller, all or part, with `MishkaPay.refund_application_fee/4`. A guarded_struct the
provider fills in.

  * `:provider`, `:id`.
  * `:amount`: the fee taken; `:amount_refunded`: what was given back so far; `:refunded`:
    `true` once all of it was.
  * `:account_id`: the connected account that paid it.
  * `:charge_id`: the sale it was taken from.
  * `:created_at`.

# `t`

```elixir
@type t() :: %MishkaPay.ApplicationFee{
  account_id: String.t() | nil,
  amount: Money.t() | nil,
  amount_refunded: Money.t() | nil,
  charge_id: String.t() | nil,
  created_at: DateTime.t() | nil,
  id: String.t(),
  provider: String.t(),
  refunded: boolean() | nil
}
```

The struct that `builder/1` returns.

| Field | Type | Required | Default | Description | Derives |
| --- | --- | --- | --- | --- | --- |
| `:provider` | `String.t()` | yes |  |  | `validate(not_nil_value, string)` |
| `:id` | `String.t()` | yes |  |  | `validate(not_nil_value, string, not_empty)` |
| `:amount` | `Money.t()` \| `nil` | no |  |  | validator `{MishkaPay.Money, :field}` |
| `:amount_refunded` | `Money.t()` \| `nil` | no |  |  | validator `{MishkaPay.Money, :field}` |
| `:refunded` | `boolean()` \| `nil` | no | `false` |  | `validate(boolean)` |
| `:account_id` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:charge_id` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:created_at` | `DateTime.t()` \| `nil` | no |  |  | `validate(struct)` |

# `builder`

# `enforce_keys`

# `enforce_keys`

# `example`

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

# `keys`

# `keys`

---

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