Stateful client for x402 facilitator verify and settle operations.
Summary
Payment Verification
Settles a payment using the default facilitator process name.
Settles a payment using the given facilitator process.
Settles a payment using the given facilitator process and hook module.
Verifies a payment using the default facilitator process name.
Verifies a payment using the given facilitator process.
Verifies a payment using the given facilitator process and hook module.
Payment Verification
Settles a payment using the default facilitator process name.
Settles a payment using the given facilitator process.
Settles a payment using the given facilitator process and hook module.
This overrides the hook module configured when the facilitator process started.
Verifies a payment using the default facilitator process name.
Verifies a payment using the given facilitator process.
Verifies a payment using the given facilitator process and hook module.
This overrides the hook module configured when the facilitator process started.
Types
@type operation_result() :: %{status: non_neg_integer(), body: map()}
Facilitator response payload.
@type response() :: {:ok, operation_result()} | {:error, X402.Facilitator.Error.t() | X402.Hooks.hook_error() | term()}
@type server() :: GenServer.server()
Facilitator server identifier accepted by GenServer.call/3.
@type state() :: %{ url: String.t(), finch: term(), hooks: module(), max_retries: non_neg_integer(), retry_backoff_ms: non_neg_integer(), receive_timeout_ms: non_neg_integer() }
Functions
@spec child_spec(keyword()) :: Supervisor.child_spec()
Returns a child specification for X402.Facilitator.
@spec start_link(keyword()) :: GenServer.on_start() | {:error, NimbleOptions.ValidationError.t()}
Starts the facilitator client.
Options
:name(term/0) - Registered name of the facilitator client process. The default value isX402.Facilitator.:url(String.t/0) - Facilitator base URL. The default value is"https://x402.org/facilitator".:finch(term/0) - Required. Finch process name used for HTTP requests.:hooks- Lifecycle hook module implementingX402.Hooks. The default value isX402.Hooks.Default.:max_retries(non_neg_integer/0) - Maximum retry count for transient errors. The default value is2.:retry_backoff_ms(non_neg_integer/0) - Initial retry backoff in milliseconds. The default value is100.:receive_timeout_ms(non_neg_integer/0) - HTTP receive timeout in milliseconds. The default value is5000.