# `LatticeStripe.Card`
[🔗](https://github.com/szTheory/lattice_stripe/blob/v1.1.0/lib/lattice_stripe/card.ex#L1)

A Stripe debit card attached to a Connect connected account (external account).

Cards are one of the two sum-type members returned by
`LatticeStripe.ExternalAccount` CRUDL operations; the other is
`LatticeStripe.BankAccount`. All network operations live on
`LatticeStripe.ExternalAccount` — this module owns only the struct shape,
the `cast/1` / `from_map/1` helpers, and a PII-safe `Inspect`
implementation.

## PII and Inspect

`inspect/1` shows only `id`, `object`, `brand`, `country`, and `funding`.
The following fields are deliberately hidden because they are cardholder
data that must never appear in logs or error reports: `last4`,
`dynamic_last4`, `fingerprint`, `exp_month`, `exp_year`, `name`, every
`address_*` field, `address_line1_check`, `cvc_check`, `address_zip_check`.

## F-001 forward-compat

Unknown keys from Stripe are preserved in the `:extra` map so new fields
added by Stripe flow through without code changes. The `"deleted" => true`
flag from a `DELETE` response is preserved in `:extra`.

## Stripe API Reference

- https://docs.stripe.com/api/external_account_cards

# `t`

```elixir
@type t() :: %LatticeStripe.Card{
  account: String.t() | nil,
  address_city: String.t() | nil,
  address_country: String.t() | nil,
  address_line1: String.t() | nil,
  address_line1_check: String.t() | nil,
  address_line2: String.t() | nil,
  address_state: String.t() | nil,
  address_zip: String.t() | nil,
  address_zip_check: String.t() | nil,
  available_payout_methods: [String.t()] | nil,
  brand: String.t() | nil,
  country: String.t() | nil,
  currency: String.t() | nil,
  customer: String.t() | nil,
  cvc_check: String.t() | nil,
  default_for_currency: boolean() | nil,
  dynamic_last4: String.t() | nil,
  exp_month: integer() | nil,
  exp_year: integer() | nil,
  extra: map(),
  fingerprint: String.t() | nil,
  funding: String.t() | nil,
  id: String.t() | nil,
  last4: String.t() | nil,
  metadata: map() | nil,
  name: String.t() | nil,
  object: String.t(),
  tokenization_method: String.t() | nil
}
```

A Stripe debit card on a Connect connected account.

# `cast`

```elixir
@spec cast(map() | nil) :: t() | nil
```

Converts a decoded Stripe API map to a `%Card{}` struct.

Maps all known Stripe card fields. Any unrecognized fields are collected
into `:extra` so no data is silently lost (F-001).

# `from_map`

```elixir
@spec from_map(map() | nil) :: t() | nil
```

Alias for `cast/1`. Provided for callers that prefer the `from_map` naming.

---

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