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

Handles Source resource endpoints.

## Endpoints

- POST   /v1/sources      - Create source
- GET    /v1/sources/:id  - Retrieve source
- POST   /v1/sources/:id  - Update source
- GET    /v1/sources      - List sources

Note: Sources cannot be deleted (can only be detached from customers).

## Source Object

    %{
      id: "src_...",
      object: "source",
      created: 1234567890,
      type: "card" | "bank_account" | "sepa_debit" | "alipay" | etc.,
      customer: "cus_..." | nil,
      status: "pending" | "chargeable" | "consumed" | "canceled" | "failed",
      amount: 2000,  # Optional, for single-use sources (in cents)
      currency: "usd",
      metadata: %{},
      # ... other fields depending on source type
    }

# `create`

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

Creates a new source.

## Required Parameters

- type - Source type (card, bank_account, sepa_debit, alipay, etc.)

## Optional Parameters

- customer - Customer ID to attach source to
- amount - Amount in cents (for single-use sources)
- currency - Three-letter ISO currency code (default: "usd")
- metadata - Key-value metadata
- owner - Owner information (name, email, phone, address)
- statement_descriptor - Descriptor for bank statements

# `list`

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

Lists all sources with pagination and optional customer filter.

## Parameters

- limit - Number of items (default: 10, max: 100)
- starting_after - Cursor for pagination
- ending_before - Reverse cursor
- customer - Filter by customer ID (optional)

# `retrieve`

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

Retrieves a source by ID.

# `update`

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

Updates a source.

Note: Sources have limited updatable fields.

## Updatable Fields

- metadata
- owner
- statement_descriptor

---

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