Facilitators

Transaction verification services that enable servers to validate blockchain payments without running full nodes.

Overview

Facilitators provide REST APIs that x402 servers query to verify payment validity. This architecture eliminates the need for complex blockchain infrastructure while maintaining trustless verification.

Verification Flow

1

Payment Proof Received

Client submits transaction hash as payment proof via request headers

2

Facilitator Query

Server calls facilitator API endpoint to initiate verification

3

On-Chain Validation

Facilitator queries the blockchain to verify transaction authenticity and details

4

Result Returned

Facilitator sends verification status back to the requesting server

API Specification

The PayAI facilitator exposes a simple REST endpoint:

Verify Transaction

POSThttps://facilitator.payai.network/verify

Request Body:

{
  "txHash": "0x5f2d8a...",
  "network": "base",
  "expectedAmount": "1000000",
  "expectedRecipient": "0x742d35Cc...",
  "tokenAddress": "0x833589fCD6..."
}

Response:

{
  "valid": true,
  "verified": true,
  "tx": {
    "hash": "0x5f2d8a...",
    "from": "0x123...",
    "to": "0x742d35Cc...",
    "amount": "1000000",
    "timestamp": 1706123456
  }
}

Implementation

Server Integration

import { X402Middleware } from '@payai/x402-server';

const middleware = new X402Middleware({
  payTo: "0x742d35Cc...",
  facilitatorUrl: "https://facilitator.payai.network",
  network: "base"
});

app.use('/api/*', middleware.verify);

Deploy a Facilitator

Want to run your own facilitator? Check out the open-source implementation and deployment guides.

View on GitHub
Nova402