# `Stripe`
[🔗](https://github.com/jeffhuen/tiger_stripe/blob/main/lib/stripe.ex#L1)

Elixir SDK and client for the Stripe API.

## Client Configuration

Create a client with explicit options:

    client = Stripe.client("sk_test_...")

    {:ok, customer} = Stripe.Services.CustomerService.create(client, %{
      email: "jane@example.com"
    })

## Per-Client Options

    # Connect: act on behalf of a connected account
    client = Stripe.client("sk_test_...", stripe_account: "acct_...")

    # Explicit key with retry policy
    client = Stripe.client("sk_test_other", max_retries: 5)

## Supported Client Options

  * `:api_key` - Stripe secret key (required)
  * `:api_version` - Pin a specific Stripe API version
  * `:stripe_account` - Default connected account ID (Stripe Connect)
  * `:client_id` - OAuth client ID
  * `:max_retries` - Maximum retry attempts (default: 2)
  * `:open_timeout` - Connection timeout in ms (default: 30_000)
  * `:read_timeout` - Read timeout in ms (default: 80_000)
  * `:finch` - Custom Finch instance name (default: `Stripe.Finch`)
  * `:transport` - Custom HTTP transport for tests or advanced integrations

# `child_spec`

```elixir
@spec child_spec(keyword()) :: Supervisor.child_spec()
```

Returns a child spec for the default Finch pool.

Add this to your application's supervision tree when using the default
`Stripe.Finch` pool:

    children = [
      Stripe
    ]

Pass `finch: MyApp.Finch` to `Stripe.client/2` when using your own Finch
pool instead.

# `client`

```elixir
@spec client() :: no_return()
```

Raises because libraries should not read application configuration.

Pass an API key explicitly with `Stripe.client/1`, or read credentials from
your own application's configuration before constructing a client.

# `client`

```elixir
@spec client(String.t() | keyword()) :: Stripe.Client.t()
```

Create a new Stripe client.

When given a string, treated as an explicit API key.
When given a keyword list, the list must include `:api_key`.

## Examples

    client = Stripe.client("sk_test_...")
    client = Stripe.client(api_key: "sk_test_...", max_retries: 5)

# `client`

```elixir
@spec client(
  String.t(),
  keyword()
) :: Stripe.Client.t()
```

Create a new Stripe client with an explicit API key.

## Examples

    client = Stripe.client("sk_test_...")
    client = Stripe.client("sk_test_...", stripe_account: "acct_...", max_retries: 5)

# `version`

```elixir
@spec version() :: String.t()
```

Returns the library version.

---

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