A production-grade, idiomatic Elixir SDK for the Stripe API.
LatticeStripe provides a complete Stripe integration for Elixir applications — payments, webhooks, telemetry, and test helpers included.
Quick Start
Add LatticeStripe to your supervision tree, then create a client and make calls:
# In your application supervisor:
children = [
{Finch, name: MyApp.Finch}
]
# Create a client (once, at startup):
client = LatticeStripe.Client.new!(
api_key: "sk_test_...",
finch: MyApp.Finch
)
# Charge a customer:
{:ok, pi} = LatticeStripe.PaymentIntent.create(client, %{
"amount" => 2000,
"currency" => "usd"
})Modules
LatticeStripe.Client— Create and configure API clientsLatticeStripe.PaymentIntent— Accept paymentsLatticeStripe.Customer— Manage customersLatticeStripe.PaymentMethod— Save and reuse payment instrumentsLatticeStripe.SetupIntent— Save payment methods for future useLatticeStripe.Refund— Issue refundsLatticeStripe.Checkout.Session— Hosted payment pagesLatticeStripe.Webhook— Verify and handle incoming webhooksLatticeStripe.Telemetry— Observability eventsLatticeStripe.Testing— Test helpers for webhook simulation
Error Handling
All functions return {:ok, result} or {:error, %LatticeStripe.Error{}}.
The Error.type field enables clean pattern matching:
case LatticeStripe.Customer.create(client, params) do
{:ok, customer} -> handle_success(customer)
{:error, %LatticeStripe.Error{type: :card_error} = err} -> handle_card_error(err)
{:error, %LatticeStripe.Error{type: :rate_limit_error}} -> handle_rate_limit()
{:error, %LatticeStripe.Error{}} -> handle_error()
endBang variants (create!/2, retrieve!/2, etc.) raise LatticeStripe.Error on failure.
Summary
Functions
Returns the Stripe API version this release of LatticeStripe is pinned to.
Functions
@spec api_version() :: String.t()
Returns the Stripe API version this release of LatticeStripe is pinned to.
This version is used as the default Stripe-Version header on all requests.
Override per-client via the :api_version option in LatticeStripe.Client.new!/1,
or per-request via the :stripe_version option in request opts.