Validated configuration for a Sumup client.
Build a config once (typically at application boot, or per-request if you serve multiple SumUp merchants from one app) and pass it to every resource function:
config = Sumup.Config.new!(api_key: {:system, "SUMUP_API_KEY"})
{:ok, checkout} = Sumup.Checkouts.get(config, "checkout_id")Options
:api_key(String.t()or{:system, String.t()}or{module(), atom(), list()}) - Your SumUp secret API key (sk_live_.../sk_test_...), or a restricted key. Mutually exclusive with:access_token-- if both are given,:access_tokenwins. Accepts a raw string, a{:system, "ENV_VAR"}tuple resolved at config-build time, or an{module, function, args}tuple for e.g. secrets managers.:access_token(String.t()or{:system, String.t()}or{module(), atom(), list()}) - An OAuth2 access token, resolved the same way as:api_key.:base_url(String.t/0) - API base URL. Override for testing against a mock server. The default value is"https://api.sumup.com".:receive_timeout(pos_integer/0) - Response timeout in ms. The default value is30000.:connect_timeout(pos_integer/0) - Connection timeout in ms. The default value is10000.:max_retries(non_neg_integer/0) - Max retry attempts for retryable errors (429 and 5xx). The default value is3.:retry_base_delay(pos_integer/0) - Base delay in ms for exponential backoff (doubles per attempt, with jitter). The default value is250.:retry_max_delay(pos_integer/0) - Maximum backoff delay in ms. The default value is5000.:telemetry_prefix(list ofatom/0) - Prefix used for:telemetry.span/3events, seeSumup.Telemetry. The default value is[:sumup].:user_agent(String.t/0) - Override the User-Agent header.:req_options(keyword/0) - Extra options merged into everyReq.new/1call (e.g.:plugfor testing,:finchpool name). The default value is[].:finch_pool(atom/0) - Name of a Finch pool to use instead of the default one.
Summary
Functions
Builds a config, returning {:ok, config} or {:error, exception}.
Builds a config, raising NimbleOptions.ValidationError on invalid input.
Types
@type t() :: %Sumup.Config{ access_token: String.t() | nil, api_key: String.t() | nil, base_url: String.t(), connect_timeout: pos_integer(), finch_pool: atom() | nil, max_retries: non_neg_integer(), receive_timeout: pos_integer(), req_options: keyword(), retry_base_delay: pos_integer(), retry_max_delay: pos_integer(), telemetry_prefix: [atom()], user_agent: String.t() }
Functions
@spec new(keyword()) :: {:ok, t()} | {:error, Exception.t()}
Builds a config, returning {:ok, config} or {:error, exception}.
Builds a config, raising NimbleOptions.ValidationError on invalid input.