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_...orsk_live_...)
Optional Options
:finch- Name of the Finch pool for HTTP requests. Defaults toLatticeStripe.Finch, started automatically at application boot unless disabled viaconfig :lattice_stripe, start_default_finch: false. Pass your own pool name to override.
See schema/0 for full option documentation with defaults.
Example
# Zero-config: the default LatticeStripe.Finch pool is started for you.
{:ok, config} = LatticeStripe.Config.validate(api_key: "sk_test_...")
# Or bring your own pool. In your application supervisor:
children = [
{Finch, name: MyApp.Finch}
]
# Then pass it explicitly to override the default:
{: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
Returns the NimbleOptions schema used for validation.
Validates the given options against the config schema.
Returns {:ok, validated_opts} on success or {:error, %NimbleOptions.ValidationError{}}
on failure.
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.