Paysafe.Config (Paysafe v1.0.0)

Copy Markdown View Source

Configuration for the Paysafe client.

Options

  • :username - (required) API username from the Paysafe Business Portal.
  • :password - (required) API password from the Paysafe Business Portal.
  • :environment - :test or :production. Defaults to :test.
  • :account_id - Default account ID for requests. Can be overridden per-call.
  • :base_url_override - Override the computed base URL entirely. Primarily intended for testing (pointing at a local mock server) or routing through a corporate proxy. When set, this replaces the :environment-derived base URL for every API (Payments, Scheduler, Applications, etc).
  • :http_options - Options passed directly to Req. Defaults to [].
  • :timeout - Request timeout in milliseconds. Defaults to 30_000.
  • :recv_timeout - Receive timeout in milliseconds. Defaults to 30_000.
  • :max_retries - Maximum number of retries on transient failures. Defaults to 3.
  • :retry_delay - Base delay in ms between retries (exponential backoff). Defaults to 500.
  • :rate_limit - {scale_ms, limit} tuple for token bucket rate limiting. Defaults to {1_000, 100}.
  • :telemetry_prefix - Telemetry event prefix. Defaults to [:paysafe].

Example

config :paysafe,
  username: "1001062690",
  password: "B-qa2-0-...",
  environment: :test,
  account_id: "1009688230"

Summary

Functions

Returns the Applications (Onboarding) API base URL.

Computes the Base64-encoded Basic Auth header value.

Returns the Bank Account Validator API base URL (also used by the Interac Verification Service, which lives under /verifiedme on the same base).

Returns the full base URL for the configured environment, or base_url_override if set.

Returns the Cards API base URL.

Returns the Customer Identification (KYC) API base URL.

Returns the Customer Vault API base URL.

Returns the Direct Debit API base URL.

Load config from the application environment and merge with any overrides.

Returns the FX Rates API base URL.

Build and validate a Config struct from a keyword list or map.

Returns the Payments API base URL.

Returns the Payment Scheduler API base URL.

Returns the NimbleOptions schema for external inspection.

Types

t()

@type t() :: %Paysafe.Config{
  account_id: String.t() | nil,
  base_url_override: String.t() | nil,
  environment: :test | :production,
  http_options: keyword(),
  max_retries: non_neg_integer(),
  password: String.t(),
  rate_limit: {pos_integer(), pos_integer()},
  recv_timeout: pos_integer(),
  retry_delay: pos_integer(),
  telemetry_prefix: [atom()],
  timeout: pos_integer(),
  username: String.t()
}

Functions

applications_url(config)

@spec applications_url(t()) :: String.t()

Returns the Applications (Onboarding) API base URL.

auth_header(config)

@spec auth_header(t()) :: String.t()

Computes the Base64-encoded Basic Auth header value.

bank_account_validator_url(config)

@spec bank_account_validator_url(t()) :: String.t()

Returns the Bank Account Validator API base URL (also used by the Interac Verification Service, which lives under /verifiedme on the same base).

base_url(config)

@spec base_url(t()) :: String.t()

Returns the full base URL for the configured environment, or base_url_override if set.

cards_url(config)

@spec cards_url(t()) :: String.t()

Returns the Cards API base URL.

customer_identification_url(config)

@spec customer_identification_url(t()) :: String.t()

Returns the Customer Identification (KYC) API base URL.

customer_vault_url(config)

@spec customer_vault_url(t()) :: String.t()

Returns the Customer Vault API base URL.

direct_debit_url(config)

@spec direct_debit_url(t()) :: String.t()

Returns the Direct Debit API base URL.

from_env!(overrides \\ [])

@spec from_env!(keyword()) :: t()

Load config from the application environment and merge with any overrides.

fx_rates_url(config)

@spec fx_rates_url(t()) :: String.t()

Returns the FX Rates API base URL.

new!(opts)

@spec new!(keyword() | map()) :: t()

Build and validate a Config struct from a keyword list or map.

Raises NimbleOptions.ValidationError on invalid input.

payments_url(config)

@spec payments_url(t()) :: String.t()

Returns the Payments API base URL.

scheduler_url(config)

@spec scheduler_url(t()) :: String.t()

Returns the Payment Scheduler API base URL.

schema()

@spec schema() :: NimbleOptions.t()

Returns the NimbleOptions schema for external inspection.