facilitator.questflow.ai
X402 Facilitator Service

About Our Projects

Questflow
The AI Agent Economy for Every Workflow. Build the orchestration layer for the multi-agent economy onchain. Questflow powers Tars 2.0, the first AI Agent to connect to all of your apps.
Visit questflow.ai

Getting Started Guide

Learn how to integrate the Questflow X402 Facilitator into your application to enable crypto payments for your APIs and services.

1

Installation

Install the required dependencies based on your framework:

# For Express.js
npm install x402-express @coinbase/x402

# For Python
pip install x402-python cdp-sdk
2

Configure the Facilitator

Create your Facilitator configuration object with authentication headers:

{
  url: 'https://facilitator.questflow.ai',
  createAuthHeaders: async () => {
    return {
      verify: {
        Authorization: `Bearer ${process.env.FACILITATOR_API_KEY}`,
      },
      settle: {
        Authorization: `Bearer ${process.env.FACILITATOR_API_KEY}`,
      },
      supported: {
        Authorization: `Bearer ${process.env.FACILITATOR_API_KEY}`,
      },
      list: {
        Authorization: `Bearer ${process.env.FACILITATOR_API_KEY}`,
      },
    };
  },
}

Note: Store your FACILITATOR_API_KEY securely in environment variables.

3

Add Payment Middleware

Integrate the payment middleware into your Express.js application:

import express from "express";
import { paymentMiddleware } from "x402-express";

const app = express();

const facilitatorConfig = {
  url: 'https://facilitator.questflow.ai',
  createAuthHeaders: async () => {
    return {
      verify: {
        Authorization: `Bearer ${process.env.FACILITATOR_API_KEY}`,
      },
      settle: {
        Authorization: `Bearer ${process.env.FACILITATOR_API_KEY}`,
      },
      supported: {
        Authorization: `Bearer ${process.env.FACILITATOR_API_KEY}`,
      },
      list: {
        Authorization: `Bearer ${process.env.FACILITATOR_API_KEY}`,
      },
    };
  },
};

app.use(paymentMiddleware(
  "0xYourWalletAddress", // Your receiving wallet
  {
    "GET /api/data": {
      price: "$0.01",
      network: "base",
      config: {
        description: "Access premium API data",
        inputSchema: {
          type: "object",
          properties: {
            query: { type: "string" }
          }
        }
      }
    }
  },
  facilitatorConfig
));
4

Test Your Integration

Make a test request to your protected endpoint:

curl http://localhost:3000/api/data

The server will respond with 402 Payment Required and payment instructions. Complete the payment and retry with the payment proof in the X-PAYMENT header.

Connect With Us

Apply for Facilitator Access
Interested in using our X402 Facilitator service? Submit your application and our team will get back to you.
Submit Application →