Frameworks
Elixir / Phoenix — Intégration Scell.io
Pas de SDK Elixir — HTTPoison ou Req
Scell.io ne publie PAS de SDK Elixir officiel. En Phoenix, créer un module GenServer ou simple module fonctionnel utilisant `Req` (recommandé) ou `HTTPoison`. Configuration via `config/runtime.exs` avec `System.get_env("SCELL_API_KEY")`. Idéal pour patterns supervisor : retry automatique via Tesla middleware ou Req plugins.
À retenir
- Pas de SDK Elixir officiel — `Req` ou `HTTPoison`
- Module fonctionnel ou GenServer
- Config via `config/runtime.exs`
- Pattern supervisor pour retry/circuit-breaker
- Compatible Phoenix 1.7+, Elixir 1.16+
Exemple de code
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