# `OpenPayments.Types.GrantResponse`
[🔗](https://github.com/interledger/open-payments-elixir/blob/v1.0.0/lib/open_payments/types/grant_response.ex#L1)

A response to an initial grant request, with typed nested protocol data.

Required `continue` contains a `Continuation`. Exactly one of `interact`
(`InteractionResponse`) or `access_token` (`AccessToken`) must be present,
representing pending interaction or immediate approval. These are initial
response rules; subject-only and wait-only continuation results are different
response contracts.

Optional `subject` is decoded as `Subject`, following the Node SDK's grant model
and the initial schema's permission for extra fields. Subject alone does not
replace the required initial-response branch. All recognized fields are
validated when present, including explicit-null rejection; remaining JSON data
is retained in `extensions`.

Inspection omits payload values. Explicit map/JSON exports include tokens,
callback values, subject identifiers and card results. This codec makes no
requests, verifies no callbacks and does not establish permission to use a
resource. Predicates report typed branch shape; use `validate/1` to revalidate
modified structs. `to_map/1` converts shape without validating it.

# `t`

```elixir
@type t() :: %OpenPayments.Types.GrantResponse{
  access_token: OpenPayments.Types.AccessToken.t() | nil,
  continue: OpenPayments.Types.Continuation.t(),
  extensions: %{optional(String.t()) =&gt; term()},
  interact: OpenPayments.Types.InteractionResponse.t() | nil,
  subject: OpenPayments.Types.Subject.t() | nil
}
```

# `approved?`

```elixir
@spec approved?(t()) :: boolean()
```

Reports immediate access-token approval shape without revalidating nested values.

# `from_map`

```elixir
@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}
```

Decodes an initial grant response and validates its typed fields and branch.

# `pending?`

```elixir
@spec pending?(t()) :: boolean()
```

Reports pending-interaction branch shape without revalidating nested values.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts to protocol fields, including sensitive values, without validating.

# `validate`

```elixir
@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}
```

Revalidates every typed child, the initial-response branch and extensions.

---

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