LatticeStripe
A production-grade, idiomatic Elixir SDK for the Stripe API.
Full documentation available on HexDocs.
Installation
Add lattice_stripe to your dependencies in mix.exs:
def deps do
[
{:lattice_stripe, "~> 0.1"}
]
endQuick Start
Add Finch to your supervision tree in application.ex:
children = [
{Finch, name: MyApp.Finch}
]Then create a client and make your first API call:
client = LatticeStripe.Client.new!(
api_key: "sk_test_...",
finch: MyApp.Finch
)
{:ok, payment_intent} = LatticeStripe.PaymentIntent.create(client, %{
"amount" => 2000,
"currency" => "usd",
"payment_method" => "pm_card_visa",
"confirm" => true,
"automatic_payment_methods" => %{"enabled" => true, "allow_redirects" => "never"}
})
IO.puts("PaymentIntent created: #{payment_intent.id}")Features
- Payments — Customer, PaymentIntent, SetupIntent, PaymentMethod, Refund
- Checkout — Checkout.Session (payment, subscription, and setup modes)
- Webhooks — Signature verification and Phoenix Plug integration
- Auto-pagination — Stream through large result sets lazily with Elixir Streams
- Telemetry — Request lifecycle events compatible with any monitoring stack
- Configurable transport — Finch by default; bring your own HTTP client via the Transport behaviour
- Retry with backoff — Automatic exponential backoff respecting Stripe's
Stripe-Should-Retryheader - Idempotency — Automatic idempotency key generation and replay handling
- Structured errors — Pattern-matchable error types:
:card_error,:auth_error,:rate_limit_error,:server_error, and more - Connect support — Per-client and per-request
stripe_accountfor platform integrations
Compatibility
| Requirement | Version |
|---|---|
| Elixir | >= 1.15 |
| Erlang/OTP | >= 26 |
| Stripe API | 2026-03-25.dahlia |
Documentation
Full documentation with guides, examples, and API reference is available on HexDocs.
Guides available:
- Getting Started
- Client Configuration
- Payments
- Checkout
- Webhooks
- Error Handling
- Testing
- Telemetry
- Extending LatticeStripe
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
MIT — see LICENSE for details.