# `PaperTiger.Resources.Card`
[🔗](https://github.com/EnaiaInc/paper_tiger/blob/v1.2.2/lib/paper_tiger/resources/card.ex#L1)

Handles Card resource endpoints.

**DEPRECATED**: Cards are deprecated in favor of PaymentMethod, but still supported
for backward compatibility.

## Endpoints

- POST   /v1/customers/:customer_id/sources - Create card (attach to customer)
- GET    /v1/customers/:customer_id/sources/:id - Retrieve card
- POST   /v1/customers/:customer_id/sources/:id - Update card
- DELETE /v1/customers/:customer_id/sources/:id - Delete card (detach from customer)
- GET    /v1/customers/:customer_id/sources - List cards (filtered by customer)

## Card Object

    %{
      id: "card_...",
      object: "card",
      created: 1234567890,
      customer: "cus_...",
      brand: "Visa",
      last4: "4242",
      exp_month: 12,
      exp_year: 2025,
      fingerprint: "hash...",
      funding: "credit",
      metadata: %{},
      # ... other fields
    }

# `create`

```elixir
@spec create(Plug.Conn.t()) :: Plug.Conn.t()
```

Creates a new card (attaches to customer).

## Required Parameters

- customer - Customer ID to attach card to

## Optional Parameters

- source - Token ID or map of card details
- brand - Card brand (Visa, Mastercard, American Express, Discover)
- last4 - Last 4 digits
- exp_month - Expiration month
- exp_year - Expiration year
- funding - Funding type (credit, debit, prepaid)
- metadata - Key-value metadata

# `delete`

```elixir
@spec delete(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Deletes a card (detaches from customer).

Returns a deletion confirmation object.

# `list`

```elixir
@spec list(Plug.Conn.t()) :: Plug.Conn.t()
```

Lists all cards for a customer with pagination.

## Parameters

- customer - Customer ID (required for filtering)
- limit - Number of items (default: 10, max: 100)
- starting_after - Cursor for pagination
- ending_before - Reverse cursor

# `retrieve`

```elixir
@spec retrieve(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Retrieves a card by ID.

# `update`

```elixir
@spec update(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Updates a card.

## Updatable Fields

- exp_month
- exp_year
- metadata
- address_city
- address_country
- address_line1
- address_line2
- address_state
- address_zip

---

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