LatticeStripe.Config (LatticeStripe v0.2.0)

Copy Markdown View Source

Client configuration schema and validation.

Uses NimbleOptions to validate all client options at creation time, providing clear error messages for invalid configuration.

Required Options

  • :api_key - Your Stripe API key (sk_test_... or sk_live_...)
  • :finch - Name of the Finch pool started in your supervision tree

Optional Options

See schema/0 for full option documentation with defaults.

Example

# In your application supervisor:
children = [
  {Finch, name: MyApp.Finch}
]

# Create a validated config:
{:ok, config} = LatticeStripe.Config.validate(
  api_key: "sk_test_...",
  finch: MyApp.Finch
)

Summary

Functions

Returns the NimbleOptions schema used for validation.

Validates the given options against the config schema.

Validates the given options against the config schema, raising on failure.

Functions

schema()

Returns the NimbleOptions schema used for validation.

validate(opts)

Validates the given options against the config schema.

Returns {:ok, validated_opts} on success or {:error, %NimbleOptions.ValidationError{}} on failure.

validate!(opts)

Validates the given options against the config schema, raising on failure.

Returns the validated keyword list on success, or raises NimbleOptions.ValidationError with a descriptive message on failure.