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

Card authorization credentials or results carried on outgoing-payment access.

The pinned schema requires string `tlvData` and `requestId` fields. Optional
string `pinBlock` requires typed `pwk` PIN working-key data whenever present;
`pwk` may also be supplied without a PIN block. Additional fields are forbidden.
Omitted optional fields become nil; explicit JSON null is rejected.

Field strings are preserved without TLV parsing, hex/length checks, UUID
requirements or PIN cryptography. Request-ID generation and replay correlation
belong to the operation layer. This data codec makes no network requests.

Inspection omits all values. Explicit `to_map/1` and JSON encoding contain
sensitive card/key data; validation errors retain only safe field paths.
Validate manually constructed or modified structs with `validate/1`;
`to_map/1` converts shape without validating it.

# `t`

```elixir
@type t() :: %OpenPayments.Types.CardAuthorization{
  pin_block: String.t() | nil,
  pwk: OpenPayments.Types.PINWorkingKey.t() | nil,
  request_id: String.t(),
  tlv_data: String.t()
}
```

# `from_map`

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

Decodes card authorization JSON and enforces the pinBlock-to-pwk dependency.

# `to_map`

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

Converts to protocol fields, including sensitive payload data, without validating.

# `validate`

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

Validates a struct, treating nil optional fields as omitted.

---

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