Server-side x402 v2 exact settlement through a configurable facilitator.
Verifies PAYMENT-SIGNATURE, binds route and body, claims the authorization
nonce, settles, and attaches PAYMENT-RESPONSE. Coexists with native
Payment-auth on the same MPP.Plug endpoint.
The facilitator always receives the server-configured requirements that the
echoed accepted matched (including extra), never the client's copy —
refs/mppx/src/x402/server/EvmCharge.ts facilitatorPayment. A
route-bound credential (extensions.mppx.info.nonce) must echo the
advertised :extensions (schema and info, minus the client nonce salt)
before its nonce is recomputed — mppx containsExtensions.
Summary
Types
@type t() :: %MPP.X402.Plug{ accepts: [map()], digest: String.t() | nil, extensions: map() | nil, facilitator: MPP.X402.Facilitator.t(), resource: map() | nil, route_binding: :resource | :required }
Functions
Build x402 plug options from MPP.Plug :x402 config.
@spec maybe_settle(Plug.Conn.t(), t() | nil, term()) :: :continue | {:ok, Plug.Conn.t()} | {:error, MPP.Errors.t()}
Settle a PAYMENT-SIGNATURE when present; otherwise continue the native handshake.
@spec put_challenge(Plug.Conn.t(), t() | nil) :: Plug.Conn.t()
Attach PAYMENT-REQUIRED to a 402 response when x402 is configured.