Skip to main content
x402 facilitator protocol layer with Chainalysis-backed compliance screening. x402 facilitators verify off-chain payment payloads and settle them on-chain. The pipeline composes address screening, MCC screening and idempotent settlement. Screening coverage depends on the configured provider and its contract; the protocol package does not itself provide a regulated service. This package is the protocol shape and orchestration layer: VerifyRequest, VerifyResponse, SettleRequest, SettleResponse, and the compliance-pipeline composer. Actual on-chain RPC calls, Chainalysis API invocations, and audit-event writes live in apps/web. The HTTP endpoints are mounted from app/api/x402/facilitator/{verify,settle}/route.ts. F1 IRON RULE: The facilitator’s SettleResponse.txHash is the facilitator’s claim, not verified fact. Operators MUST independently RPC-verify the on-chain transaction before persisting it to any audit row. This package surfaces the facilitator’s response verbatim and leaves the verification step to the consumer. The reference implementation is the serverFetchChainTx dependency in the MCP x402.pay tool.

Install

npmjs.com/package/@glideco/x402-facilitator

Two-phase protocol

x402 uses a verify-then-settle protocol:
  1. /verify — facilitator validates the off-chain EIP-712 payment payload and runs the compliance pipeline. Returns {isValid, invalidReason} without touching chain state.
  2. /settle — facilitator broadcasts the on-chain transaction after a TOCTOU re-verify pass. Returns {success, txHash, network}.
The handleVerify and handleSettle orchestrators implement this contract. Settlement uses a store-before-broadcast pattern: a pending sentinel is written before invoking broadcast so a process kill mid-broadcast does not re-broadcast on replay.

API surface

Wiring the /verify route

Compliance pipeline

The pipeline is composable — each screener returns 'allow' | 'block' | 'review'. The first non-allow result short-circuits; 'review' is treated as block (conservative posture).

Idempotency defense

The cache key is content-bound to defend against cross-tenant cache poisoning. An attacker who guesses a victim’s idempotency key also needs to match the exact (payTo, network, paymentPayload) triple:

Verify response invalidReason vocabulary

Reading list