# `LatticeStripe.Transport`
[🔗](https://github.com/szTheory/lattice_stripe/blob/v0.2.0/lib/lattice_stripe/transport.ex#L1)

HTTP transport behaviour for LatticeStripe.

The default transport uses Finch (`LatticeStripe.Transport.Finch`).
To use a different HTTP client, implement this behaviour and pass
`transport: MyTransport` to `Client.new!/1`.

## Example

    defmodule MyApp.Transport do
      @behaviour LatticeStripe.Transport

      @impl true
      def request(%{method: method, url: url, headers: headers, body: body, opts: opts}) do
        # Your HTTP client call here
        {:ok, %{status: 200, headers: [], body: "..."}}
      end
    end

## Contract

The callback receives a plain map with these keys:
- `method` - HTTP method atom (`:get`, `:post`, `:delete`)
- `url` - Full URL string (`"https://api.stripe.com/v1/customers"`)
- `headers` - List of `{name, value}` string tuples
- `body` - Request body string or `nil`
- `opts` - Keyword list with transport-specific options (e.g., `finch: MyFinch, timeout: 30_000`)

Returns `{:ok, response_map}` or `{:error, reason}` where response_map has:
- `status` - HTTP status integer
- `headers` - List of `{name, value}` string tuples
- `body` - Response body string

# `request_map`

```elixir
@type request_map() :: %{
  method: atom(),
  url: String.t(),
  headers: [{String.t(), String.t()}],
  body: binary() | nil,
  opts: keyword()
}
```

# `response_map`

```elixir
@type response_map() :: %{
  status: pos_integer(),
  headers: [{String.t(), String.t()}],
  body: binary()
}
```

# `request`

```elixir
@callback request(request_map()) :: {:ok, response_map()} | {:error, term()}
```

---

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