HTTP client for the Payzum API: auth, retries, backoff, typed errors.
Only three of the sixteen error codes are retryable. QUOTA_EXCEEDED arrives as
a 429 and is NOT one of them — it means too many invoices are open, so retrying
makes the situation worse. Treating every 429 as retryable is the obvious
mistake.
More importantly, an unsafe request is never retried automatically: invoice
creation accepts an Idempotency-Key, but the API documents that as best-effort
with roughly 60 seconds of eventual consistency, and it does not enforce
order_id uniqueness. A blind retry can create a second real invoice and charge
twice.
Every function returns {:ok, value} or {:error, exception}, which is how
Elixir reports a failure a caller may want to handle.
Summary
Functions
Seconds to wait before the first safe retry of a create call.
Query GET /v1/status, unauthenticated.
Create a client for production.
Create a client for staging, which has isolated data and separate keys.
A webhook verifier for the given signing secret.
Types
@type t() :: %Payzum.Client{ config: Payzum.Config.t(), sleeper: (non_neg_integer() -> any()), transport: (Payzum.Request.t() -> {:ok, Payzum.Response.t()} | {:error, Exception.t()}) }
Functions
Seconds to wait before the first safe retry of a create call.
@spec health(t()) :: {:ok, map()} | {:error, Exception.t()}
Query GET /v1/status, unauthenticated.
Useful as a connectivity probe before blaming your own network.
Create a client for production.
Create a client for staging, which has isolated data and separate keys.
@spec webhooks(String.t(), keyword()) :: {:ok, Payzum.Webhooks.t()} | {:error, Payzum.Errors.Signature.t()}
A webhook verifier for the given signing secret.