API Reference X402 v#0.6.0

Copy Markdown View Source

Modules

Convenience API for working with x402 payment headers and wallet addresses.

Base58 encoding and decoding using the Bitcoin alphabet.

Utilities for working with Elixir behaviours and callback implementations.

Transport-agnostic payer client for x402 v2 payments.

Finch-backed payer client with an automatic 402 → sign → retry flow.

EIP-3009 TransferWithAuthorization building and EIP-712 signing.

Generic EIP-712 hashing primitives.

ERC-6492 signature wrapper parsing and building.

Bazaar discovery extension for x402 v2: extension builder and discovery client.

Builds, signs, and validates the eip2612GasSponsoring extension.

Builds and validates the erc20ApprovalGasSponsoring extension.

Offer-and-receipt extension for x402: signed offers and signed receipts.

Compact JWS signing and verification for the offer-receipt extension.

Encodes and decodes x402 payment identifier payloads.

Behaviour and adapter helpers for payment identifier idempotency caches.

ETS-backed cache adapter for payment identifier idempotency.

Redis-backed cache adapter for payment identifier idempotency.

Encodes and decodes SIWX messages and SIGN-IN-WITH-X header values.

ETS-backed SIWX storage with TTL-based expiration.

Behaviour for storing SIWX access records.

Behaviour for SIWX signature verification.

Default EVM SIWX signature verifier using ex_secp256k1.

Client for the x402 facilitator API: verify, settle, supported, discovery.

Behaviour for facilitator request authentication.

Authentication for the Coinbase Developer Platform (CDP) x402 facilitator.

Facilitator-role engine: verify and settle x402 payments yourself.

Structured error returned by facilitator client operations.

HTTP transport for facilitator requests.

Serializes fee-payer transaction nonces for concurrent settlements.

Behaviour for pending-settlement reconciliation stores.

ETS-backed pending-settlement store adapter.

Facilitator-role engine for exact payments on Solana (solana:*).

Behaviour for lifecycle hooks around facilitator verify and settle operations.

Context passed between x402 lifecycle hook callbacks.

Default no-op implementation of X402.Hooks.

x402 v2 payment flows over the Model Context Protocol (MCP transport).

Client half of the x402 MCP transport: pay for tool calls automatically.

Server half of the x402 MCP transport: gates a tool handler behind payment.

Encodes and decodes the x402 PAYMENT-REQUIRED header value.

Validation and matching helpers for x402 v2 payment requirements.

Encodes and decodes the x402 PAYMENT-RESPONSE header value.

Decodes and validates x402 v2 PAYMENT-SIGNATURE header values.

Behaviour for rendering browser-facing HTML paywall pages.

Self-contained HTML paywall page for browser-facing 402 responses.

Permit2 PermitWitnessTransferFrom building and EIP-712 signing for the x402 upto scheme on EVM networks.

Plug scaffold exposing one or more facilitator engines as the facilitator HTTP API.

Plug middleware that gates configured routes behind x402 v2 payment verification.

Minimal pure RLP (Recursive Length Prefix) encoding.

Minimal Ethereum JSON-RPC client over Finch.

Behaviour for pluggable x402 payment schemes.

Shared local pre-checks for EVM authorization-style scheme payloads.

Built-in X402.Scheme for exact payments on EVM (eip155:*) networks.

Built-in X402.Scheme for exact payments on Solana (solana:*) networks.

Resolves (scheme, network) pairs to X402.Scheme modules.

Built-in X402.Scheme for upto payments on EVM (eip155:*) networks.

Behaviour for client-side payment signers.

X402.Signer backed by a raw secp256k1 private key held in memory.

X402.Signer backed by a raw Ed25519 private key held in memory.

Solana address primitives: program IDs, PDA and ATA derivation.

Minimal Solana JSON-RPC calls over an X402.RPC endpoint.

Solana v0 transaction message building, serialization, and decoding.

Telemetry event definitions and emission helpers for x402 operations.

Minimal EIP-1559 (type-2) transaction encoding and signing digests.

Shared utility functions for the X402 library.

Local verification of EVM exact/eip3009 payment payloads.

Local verification of SVM exact payment payloads.

Wallet address validation utilities for x402.