# X402 v0.9.6 - API Reference

## Modules

- Core Protocol
  - [X402](X402.md): Convenience API for working with x402 payment headers and wallet addresses.
  - [X402.ExtensionResponses](X402.ExtensionResponses.md): Encodes and decodes the `EXTENSION-RESPONSES` facilitator sidechannel.
  - [X402.PaymentRequired](X402.PaymentRequired.md): Encodes and decodes the x402 `PAYMENT-REQUIRED` header value.
  - [X402.PaymentRequirements](X402.PaymentRequirements.md): Validation and matching helpers for x402 v2 payment requirements.
  - [X402.PaymentResponse](X402.PaymentResponse.md): Encodes and decodes the x402 `PAYMENT-RESPONSE` header value.
  - [X402.PaymentSignature](X402.PaymentSignature.md): Decodes and validates x402 v2 `PAYMENT-SIGNATURE` header values.

- Payer Client
  - [X402.Client](X402.Client.md): Transport-agnostic payer client for x402 v2 payments.
  - [X402.Client.Budget](X402.Client.Budget.md): A session spend budget shared by payer clients.
  - [X402.Client.Finch](X402.Client.Finch.md): Finch-backed payer client with an automatic 402 → sign → retry flow.
  - [X402.Client.Hooks](X402.Client.Hooks.md): Behaviour for lifecycle hooks around client payment creation.
  - [X402.Client.Hooks.Context](X402.Client.Hooks.Context.md): Context passed between `X402.Client.Hooks` callbacks.
  - [X402.Client.Hooks.Default](X402.Client.Hooks.Default.md): Default no-op implementation of `X402.Client.Hooks`.
  - [X402.Client.Policy](X402.Client.Policy.md): Ready-made selection policies for `X402.Client.select_requirements/2`.
  - [X402.Client.SIWX](X402.Client.SIWX.md): Client side of the `sign-in-with-x` extension: answering a challenge.
  - [X402.EIP3009](X402.EIP3009.md): EIP-3009 `TransferWithAuthorization` building and EIP-712 signing.
  - [X402.EIP712](X402.EIP712.md): Generic [EIP-712](https://eips.ethereum.org/EIPS/eip-712) hashing primitives.
  - [X402.Permit2](X402.Permit2.md): Permit2 `PermitWitnessTransferFrom` building, EIP-712 signing, and proxy
settlement calldata for the x402 `exact` (Permit2 transfer method) and
`upto` schemes on EVM networks.
  - [X402.Signer](X402.Signer.md): Behaviour for client-side payment signers.
  - [X402.Signer.LocalKey](X402.Signer.LocalKey.md): `X402.Signer` backed by a raw secp256k1 private key held in memory.
  - [X402.Signer.SolanaKey](X402.Signer.SolanaKey.md): `X402.Signer` backed by a raw Ed25519 private key held in memory.

- Facilitator Client
  - [X402.Facilitator](X402.Facilitator.md): Client for the x402 facilitator API: verify, settle, supported, discovery.
  - [X402.Facilitator.Auth](X402.Facilitator.Auth.md): Behaviour for facilitator request authentication.
  - [X402.Facilitator.Auth.CDP](X402.Facilitator.Auth.CDP.md): Authentication for the Coinbase Developer Platform (CDP) x402 facilitator.
  - [X402.Facilitator.Error](X402.Facilitator.Error.md): Structured error returned by facilitator client operations.

  - [X402.Facilitator.Failover](X402.Facilitator.Failover.md): Multi-endpoint failover policy for `X402.Facilitator`.
  - [X402.Facilitator.HTTP](X402.Facilitator.HTTP.md): HTTP transport for facilitator requests.
  - [X402.Hooks](X402.Hooks.md): Behaviour for lifecycle hooks around facilitator verify and settle operations.
  - [X402.Hooks.Context](X402.Hooks.Context.md): Context passed between x402 lifecycle hook callbacks.
  - [X402.Hooks.Default](X402.Hooks.Default.md): Default no-op implementation of `X402.Hooks`.
  - [X402.Hooks.RequestContext](X402.Hooks.RequestContext.md): Context of a protected request passed to the resource-server lifecycle hooks.

- Plug Integration
  - [X402.Extension](X402.Extension.md): Behaviour for resource-server extension adapters run by `X402.Plug.PaymentGate`.
  - [X402.Paywall](X402.Paywall.md): Behaviour for rendering browser-facing HTML paywall pages.
  - [X402.Paywall.Default](X402.Paywall.Default.md): Self-contained HTML paywall page for browser-facing 402 responses.
  - [X402.Plug.HTTPSignatureDirectory](X402.Plug.HTTPSignatureDirectory.md): Plug serving a signature agent's key directory at
`/.well-known/http-message-signatures-directory`.
  - [X402.Plug.PaymentGate](X402.Plug.PaymentGate.md): Plug middleware that gates configured routes behind x402 v2 payment verification.
  - [X402.RateLimiter](X402.RateLimiter.md): Behaviour and option handling for per-wallet request rate limiting.
  - [X402.RateLimiter.ETS](X402.RateLimiter.ETS.md): Per-node fixed-window rate limiter backed by a lazily created ETS table.

- Payment Schemes
  - [X402.Scheme](X402.Scheme.md): Behaviour for pluggable x402 payment schemes.
  - [X402.Scheme.AuthCaptureEVM](X402.Scheme.AuthCaptureEVM.md): Built-in `X402.Scheme` for `auth-capture` payments on EVM (`eip155:*`)
networks.
  - [X402.Scheme.EVM](X402.Scheme.EVM.md): Shared local pre-checks for EVM authorization-style scheme payloads.
  - [X402.Scheme.ExactEVM](X402.Scheme.ExactEVM.md): Built-in `X402.Scheme` for `exact` payments on EVM (`eip155:*`) networks.
  - [X402.Scheme.ExactSVM](X402.Scheme.ExactSVM.md): Built-in `X402.Scheme` for `exact` payments on Solana (`solana:*`) networks.
  - [X402.Scheme.Registry](X402.Scheme.Registry.md): Resolves (scheme, network) pairs to `X402.Scheme` modules.
  - [X402.Scheme.UptoEVM](X402.Scheme.UptoEVM.md): Built-in `X402.Scheme` for `upto` payments on EVM (`eip155:*`) networks.

- MCP Transport
  - [X402.MCP](X402.MCP.md): x402 v2 payment flows over the Model Context Protocol (MCP transport).
  - [X402.MCP.Client](X402.MCP.Client.md): Client half of the x402 MCP transport: pay for tool calls automatically.
  - [X402.MCP.Server](X402.MCP.Server.md): Server half of the x402 MCP transport: gates a tool handler behind payment.

- Local Verification
  - [X402.ERC6492](X402.ERC6492.md): ERC-6492 signature wrapper parsing and building.
  - [X402.RPC](X402.RPC.md): Minimal Ethereum JSON-RPC client over Finch.
  - [X402.Verify.AuthCaptureEVM](X402.Verify.AuthCaptureEVM.md): Verification of `auth-capture` payments on EVM networks.
  - [X402.Verify.EVM](X402.Verify.EVM.md): Local verification of EVM `exact` (EIP-3009 and Permit2) and `upto`
(Permit2) payment payloads.
  - [X402.Verify.SVM](X402.Verify.SVM.md): Local verification of SVM `exact` payment payloads.

- Facilitator Server
  - [X402.Facilitator.Engine](X402.Facilitator.Engine.md): Facilitator-role engine: verify and settle x402 payments yourself.
  - [X402.Facilitator.NonceManager](X402.Facilitator.NonceManager.md): Serializes fee-payer transaction nonces for concurrent settlements.
  - [X402.Facilitator.PendingSettlementStore](X402.Facilitator.PendingSettlementStore.md): Behaviour for pending-settlement reconciliation stores.
  - [X402.Facilitator.PendingSettlementStore.ETS](X402.Facilitator.PendingSettlementStore.ETS.md): ETS-backed pending-settlement store adapter.
  - [X402.Facilitator.SVMEngine](X402.Facilitator.SVMEngine.md): Facilitator-role engine for `exact` payments on Solana (`solana:*`).
  - [X402.Plug.Facilitator](X402.Plug.Facilitator.md): Plug scaffold exposing one or more facilitator engines as the
facilitator HTTP API.
  - [X402.RLP](X402.RLP.md): Minimal pure [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/)
(Recursive Length Prefix) encoding.
  - [X402.Transaction](X402.Transaction.md): Minimal [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) (type-2)
transaction encoding and signing digests.

- Auth-capture
  - [X402.AuthCapture](X402.AuthCapture.md): The `auth-capture` payment scheme: flows, operations, deadlines, lifecycle
payloads, and reason strings.
  - [X402.AuthCapture.ETSStore](X402.AuthCapture.ETSStore.md): Volatile, serialized auth-capture store for development and tests.
  - [X402.AuthCapture.EVM](X402.AuthCapture.EVM.md): EVM binding primitives for the `auth-capture` scheme: commerce-payments
deployments, `PaymentInfo` hashing, authorizer typed data, and
`AuthCaptureEscrow` calldata.
  - [X402.AuthCapture.Engine](X402.AuthCapture.Engine.md): Explicit-consent auth-capture transaction execution and reconciliation.
  - [X402.AuthCapture.Journal](X402.AuthCapture.Journal.md): Durable signer-scope fencing for auth-capture transactions.
  - [X402.AuthCapture.Receipt](X402.AuthCapture.Receipt.md): Strict auth-capture receipt identity and escrow-event checks.
  - [X402.AuthCapture.Resource](X402.AuthCapture.Resource.md): Durable hold-before-handler orchestration for auth-capture escrow resources.
  - [X402.AuthCapture.Store](X402.AuthCapture.Store.md): Atomic storage contract for auth-capture execution and recovery.

- Solana
  - [X402.Base58](X402.Base58.md): Base58 encoding and decoding using the Bitcoin alphabet.
  - [X402.Solana](X402.Solana.md): Solana address primitives: program IDs, PDA and ATA derivation.
  - [X402.Solana.RPC](X402.Solana.RPC.md): Minimal Solana JSON-RPC calls over an `X402.RPC` endpoint.
  - [X402.Solana.Transaction](X402.Solana.Transaction.md): Solana v0 transaction message building, serialization, and decoding.

- Utilities
  - [X402.Behaviour](X402.Behaviour.md): Utilities for working with Elixir behaviours and callback implementations.

  - [X402.Telemetry](X402.Telemetry.md): Telemetry event definitions and emission helpers for x402 operations.
  - [X402.Telemetry.Metrics](X402.Telemetry.Metrics.md): `Telemetry.Metrics` definitions for every x402 telemetry event.
  - [X402.Telemetry.Stats](X402.Telemetry.Stats.md): Dependency-free in-memory aggregator for x402 telemetry events.
  - [X402.Utils](X402.Utils.md): Shared utility functions for the X402 library.
  - [X402.Wallet](X402.Wallet.md): Wallet address validation utilities for x402.

- HTTP Message Signatures
  - [X402.HTTPSignature](X402.HTTPSignature.md): RFC 9421 HTTP Message Signatures: sign and verify requests and responses.
  - [X402.HTTPSignature.Key](X402.HTTPSignature.Key.md): Key material for RFC 9421 HTTP Message Signatures.
  - [X402.HTTPSignature.StructuredField](X402.HTTPSignature.StructuredField.md): The RFC 8941 Structured Field subset used by HTTP Message Signatures.

- Extensions
  - [X402.Extensions.AuthHints](X402.Extensions.AuthHints.md): The x402 `auth-hints` extension: per-requirement authentication hints.
  - [X402.Extensions.AuthHints.Adapter](X402.Extensions.AuthHints.Adapter.md): `X402.Extension` adapter advertising the `auth-hints` extension.
  - [X402.Extensions.Bazaar](X402.Extensions.Bazaar.md): Bazaar discovery extension for x402 v2: extension builder and discovery client.
  - [X402.Extensions.Bazaar.Metadata](X402.Extensions.Bazaar.Metadata.md): Validation rules for bazaar service metadata and `routeTemplate` values.
  - [X402.Extensions.BuilderCode](X402.Extensions.BuilderCode.md): The x402 `builder-code` extension: ERC-8021 on-chain attribution codes.
  - [X402.Extensions.BuilderCode.Adapter](X402.Extensions.BuilderCode.Adapter.md): `X402.Extension` adapter advertising and validating the `builder-code` extension.
  - [X402.Extensions.EIP2612GasSponsoring](X402.Extensions.EIP2612GasSponsoring.md): Builds, signs, and validates the `eip2612GasSponsoring` extension.
  - [X402.Extensions.ERC20ApprovalGasSponsoring](X402.Extensions.ERC20ApprovalGasSponsoring.md): Builds and validates the `erc20ApprovalGasSponsoring` extension.
  - [X402.Extensions.HTTPMessageSignatures](X402.Extensions.HTTPMessageSignatures.md): The x402 `http-message-signatures` extension: identity through RFC 9421.
  - [X402.Extensions.HTTPMessageSignatures.Adapter](X402.Extensions.HTTPMessageSignatures.Adapter.md): `X402.Extension` adapter advertising the `http-message-signatures`
extension.
  - [X402.Extensions.OfferReceipt](X402.Extensions.OfferReceipt.md): Offer-and-receipt extension for x402: signed offers and signed receipts.
  - [X402.Extensions.OfferReceipt.JWS](X402.Extensions.OfferReceipt.JWS.md): Compact JWS signing and verification for the offer-receipt extension.
  - [X402.Extensions.PaymentIdentifier](X402.Extensions.PaymentIdentifier.md): The x402 `payment-identifier` extension: client-generated idempotency ids.
  - [X402.Extensions.PaymentIdentifier.Adapter](X402.Extensions.PaymentIdentifier.Adapter.md): `X402.Extension` adapter advertising the `payment-identifier` extension.
  - [X402.Extensions.PaymentIdentifier.Cache](X402.Extensions.PaymentIdentifier.Cache.md): Behaviour and adapter helpers for payment identifier idempotency caches.
  - [X402.Extensions.PaymentIdentifier.ETSCache](X402.Extensions.PaymentIdentifier.ETSCache.md): ETS-backed cache adapter for payment identifier idempotency.
  - [X402.Extensions.PaymentIdentifier.RedisCache](X402.Extensions.PaymentIdentifier.RedisCache.md): Redis-backed cache adapter for payment identifier idempotency.
  - [X402.Extensions.PaymentIdentifier.RedisCache.Command](X402.Extensions.PaymentIdentifier.RedisCache.Command.md): Behaviour for the Redis command layer used by
`X402.Extensions.PaymentIdentifier.RedisCache`.
  - [X402.Extensions.SIWX](X402.Extensions.SIWX.md): The x402 `sign-in-with-x` extension: CAIP-122 wallet authentication.
  - [X402.Extensions.SIWX.Challenge](X402.Extensions.SIWX.Challenge.md): Server-side Sign-In-With-X challenge advertisements.
  - [X402.Extensions.SIWX.ETSStorage](X402.Extensions.SIWX.ETSStorage.md): ETS-backed SIWX storage with TTL-based expiration.
  - [X402.Extensions.SIWX.Message](X402.Extensions.SIWX.Message.md): CAIP-122 message text for Sign-In-With-X challenges.
  - [X402.Extensions.SIWX.Server](X402.Extensions.SIWX.Server.md): Server-side Sign-In-With-X: challenge issuance, proof verification, and
payer records.
  - [X402.Extensions.SIWX.Storage](X402.Extensions.SIWX.Storage.md): Behaviour for storing SIWX access records.
  - [X402.Extensions.SIWX.Verifier](X402.Extensions.SIWX.Verifier.md): Behaviour for SIWX signature verification.
  - [X402.Extensions.SIWX.Verifier.Default](X402.Extensions.SIWX.Verifier.Default.md): Default EVM SIWX signature verifier using `ex_secp256k1`.
  - [X402.Extensions.SIWX.Verifier.Ed25519](X402.Extensions.SIWX.Verifier.Ed25519.md): SIWX signature verifier for Solana (`solana:*`) wallets.

