Skip to main content

Frameworks

Elixir / Phoenix — Scell.io integration

No Elixir SDK — HTTPoison or Req

Scell.io does NOT publish an official Elixir SDK. In Phoenix, create a GenServer or plain functional module using `Req` (recommended) or `HTTPoison`. Configure via `config/runtime.exs` with `System.get_env("SCELL_API_KEY")`. Ideal for supervisor patterns: auto-retry via Tesla middleware or Req plugins.

Key facts

  • No Elixir SDK — `Req` or `HTTPoison`
  • Functional module or GenServer
  • Config via `config/runtime.exs`
  • Supervisor pattern for retry/circuit-breaker
  • Compatible with Phoenix 1.7+, Elixir 1.16+

Code example

defmodule MyApp.Scell do
  @base "https://api.scell.io/api/v1"

  def create_invoice(buyer, amount) do
    body = %{
      format: "factur-x",
      buyer: %{name: buyer, is_individual: true},
      lines: [%{description: "Service", quantity: 1, unit_price: amount, vat_rate: 20.0}]
    }

    Req.post!("#{@base}/invoices",
      json: body,
      headers: [{"x-api-key", System.fetch_env!("SCELL_API_KEY")}]
    ).body
  end
end

See also

Your cookie preferences

We use cookies to improve your experience. Essential cookies are always active. Cookie policy.