@xentfi/x402-facilitator is the official TypeScript SDK for the XentFi x402 Payment Facilitator — a typed client for /verify, /settle, and /supported, plus helpers for signing real EIP-3009 authorizations.
What is x402?
x402 is an open convention for monetizing HTTP resources using the (long-reserved, rarely-used)402 Payment Required status code. A resource server responds 402 with a machine-readable list of accepted payment requirements; the client (often an AI agent) signs a payment authorization and retries the request with an X-PAYMENT header attached. It’s designed for agent-to-agent and agent-to-API payments where there’s no human clicking “buy” — just an agent that needs to pay for an API call and keep going.
XentFi’s facilitator implements the eip3009 scheme: payments are EIP-3009 TransferWithAuthorization signatures — a gasless, off-chain-signed authorization that a relayer (your XentFi WAAS wallet) submits on-chain during settlement.
Two roles, one SDK
💰 Resource server
You’re getting paid. Use
X402FacilitatorClient to verify() an incoming payment and settle() it on-chain — your WAAS wallet relays the transaction and receives the funds.🤖 Payer
You’re paying. Use
signEip3009Authorization() to build a real, offline EIP-712 signature from any viem LocalAccount, then attach it as the X-PAYMENT header.Backed by XentFi WAAS
On initialization, you provide your XentFi WAASapiKey and orgId — the facilitator URL and relayer wallet are fixed on the backend side. Your organization’s WAAS wallet is what pays gas (for settlement) and receives funds. These credentials are sent as headers on every request; the SDK adds them for you.
This is the same XentFi organization API key / org ID used across the platform — see Authentication for how to get one. It’s a different credential from the agent API keys used by
@xentfi/mcp-sdk, which act on behalf of a single agent rather than an organization’s WAAS wallet.Get started
Quickstart
Install the SDK and make your first
/supported call.Resource Server Guide
Monetize an API endpoint with x402.
Payer Guide
Pay an x402-protected endpoint as an agent.
API Reference
X402FacilitatorClient, types, and signing helpers.
