Conduit
npm ↗GitHub ↗← App
LIVE ON ARC TESTNET

Build with Conduit

Conduit is the first public x402 facilitator on Arc Network. Gate any API, content, or data behind USDC micropayments — paid automatically by AI agents and HTTP clients.

Facilitator URL

conduitpay.xyz/api/x402

Demo endpoint

/api/arc-stats

Network

Arc Testnet · eip155:5042002

Overview

x402 is an HTTP-native payment protocol. Instead of blocking access with a subscription or API key, your server returns a 402 Payment Required response. The client pays and retries — automatically.

Conduit is the facilitator. It handles verification, settlement, and the human pay page. You focus on your API. Conduit handles the money.

For AI agents

Agents hit your endpoint, receive a 402, sign a USDC authorization, and retry automatically. Zero human involvement.

For humans

Browser users see a clean MetaMask pay page. They connect, pay, and get your content.

For developers

One npm package. One line of code. No backend changes, no new infrastructure. Works with any Next.js API route.

For Arc

Conduit is the first and only public x402 facilitator on Arc. Every payment settles in USDC on Arc in under a second.

Quick Start

Get a USDC-gated API route live in under 5 minutes.

1. Install the package

npm install @ace_won/x402

2. Wrap your route

// app/api/your-endpoint/route.ts
import { withPayment } from "@ace_won/x402";
import { NextRequest, NextResponse } from "next/server";
async function handler(req: NextRequest) {
return NextResponse.json({ data: "your content here" });
}
// Requires 0.001 USDC to access
export const GET = withPayment({ amount: "0.001" }, handler);

3. Test it

# Returns 402 with payment details
curl -i https://your-app.vercel.app/api/your-endpoint
# Expected
HTTP/1.1 402 Payment Required
Payment-Required: eyJhY2NlcHRzIjpbeyJzY2hlb...

Live demo

Hit conduitpay.xyz/api/arc-stats in your browser. Pay 0.001 USDC. Get live Arc Network stats back in under a second.

How It Works

The full payment flow from request to response:

01

Client hits your API

No payment header — your route returns 402 with a PAYMENT-REQUIRED header containing amount, token, network, and recipient.

02

Client pays on Arc

AI agents sign an EIP-3009 USDC authorization on Arc and retry with PAYMENT-SIGNATURE header. Browsers are redirected to the Conduit pay page.

03

Conduit verifies

withPayment() calls /api/x402/verify. Checks signature, amount, recipient, nonce not already used, and USDC balance on Arc.

04

Handler is called

Verification passed — your handler runs and the response is served to the client immediately.

05

Conduit settles

withPayment() calls /api/x402/settle asynchronously. Conduit executes the USDC transfer on Arc. The payment confirms on-chain.

Security: Every EIP-3009 authorization has a unique nonce. Conduit checks authorizationState on the Arc USDC contract before processing. Replay attacks are impossible.

npm Package

@ace_won/x402 is a drop-in middleware for Next.js 14+. Install once, use on any route.

Install

npm install @ace_won/x402

All options

withPayment({
// Required
amount: "0.001", // USDC amount as string
// Optional
payTo: "0xYourWallet", // Who receives payment
// Defaults to Conduit fee collector
description: "...", // Shown in 402 response and pay page
resource: "https://...", // URL of this resource
facilitatorUrl: "...", // Defaults to Conduit's facilitator
network: "eip155:5042002", // Defaults to Arc Testnet
asset: "0x3600...", // Defaults to Arc Testnet USDC
rpcUrl: "https://rpc.testnet.arc.network",
maxTimeoutSeconds: 300, // Max payment age in seconds
}, handler);
Next.js14+
viemv2+ (peer dependency)
Node.js18+
Package@ace_won/x402 v1.0.2
View on npm ↗

API Endpoints

All endpoints live at conduitpay.xyz

GET

/api/x402

Facilitator discovery — returns supported networks, assets, and facilitator info.

POST

/api/x402/verify

Verify a payment payload. Checks signature, amount, recipient, nonce, and USDC balance.

POST

/api/x402/settle

Execute the on-chain USDC transfer. Called after your handler serves the response.

GET

/api/x402/payments

Admin — full payment history through the facilitator. Requires x-wallet-address header.

GET

/api/arc-stats

Live demo endpoint. Pay 0.001 USDC to receive live Arc Network block stats.

Verify

Call POST /api/x402/verify before serving your resource. withPayment() does this automatically.

Request body

{
"payload": "<base64 encoded payment data>",
"paymentDetails": {
"maxAmountRequired": "1000",
"payTo": "0xYourWallet",
"network": "eip155:5042002",
"asset": "0x3600000000000000000000000000000000000000"
}
}

Response — valid

{
"isValid": true,
"networkId": "eip155:5042002",
"payer": "0xABCD...",
"amount": "1000",
"token": "0x3600000000000000000000000000000000000000"
}

Response — invalid

{
"isValid": false,
"error": "Payment nonce already used"
}

What gets checked

Payload decodes to a valid payment object
validAfter has passed and validBefore has not expired
Payment amount meets the required minimum
Recipient address matches payTo
Nonce has not been used — checked via authorizationState on Arc USDC contract
Payer has sufficient USDC balance on Arc

Settle

Call POST /api/x402/settle after serving your resource. withPayment() calls this automatically in the background.

Request body

{
"payload": "<base64 encoded payment data>",
"paymentDetails": {
"payTo": "0xYourWallet",
"network": "eip155:5042002",
"asset": "0x3600000000000000000000000000000000000000"
}
}

Response

{
"success": true,
"txHash": "0x1c07e4c7...",
"network": "eip155:5042002"
}

Marketplace

The Conduit Marketplace is a public directory of x402-gated APIs. List your API so AI agents and developers can discover and pay for it automatically.

List your API

Submit your x402 endpoint. Set a USDC price per request. Earn automatically.

Get discovered

AI agents and developers browse by category. Your API is visible to the entire Arc ecosystem.

Earn per request

No subscriptions. Every request pays you in USDC on Arc. Conduit takes 0.5%.

01

Build your x402 endpoint

Use withPayment() to gate any Next.js route. Test locally with curl.

02

Submit to the marketplace

Go to conduitpay.xyz/marketplace/submit. Fill in name, description, endpoint URL, price, and category.

03

Get approved

Conduit reviews your listing within 24 hours. You receive an email when approved.

04

Start earning

Your API is live. Agents and developers pay per request in USDC automatically.

Submit your API →

Network Details

NetworkArc Testnet
Chain ID5042002
CAIP-2eip155:5042002
USDC Address0x3600000000000000000000000000000000000000
USDC Decimals6
RPC URLhttps://rpc.testnet.arc.network
Explorerhttps://testnet.arcscan.app
Facilitatorhttps://conduitpay.xyz/api/x402
Gas tokenUSDC (native)

Add Arc Testnet to MetaMask

Network name: Arc Testnet
RPC URL: https://rpc.testnet.arc.network
Chain ID: 5042002
Currency: USDC
Explorer: https://testnet.arcscan.app

Get testnet USDC

Go to faucet.circle.com → select Arc Testnet → paste your wallet address.

Code Examples

Basic — 0.001 USDC per request

import { withPayment } from "@ace_won/x402";
import { NextRequest, NextResponse } from "next/server";
export const GET = withPayment({ amount: "0.001" }, async (req: NextRequest) => {
return NextResponse.json({ data: "basic content" });
});

Pay directly to your wallet

export const GET = withPayment({
amount: "0.01",
payTo: "0xYourWalletAddress",
description: "Premium analytics data",
}, async (req: NextRequest) => {
return NextResponse.json({ analytics: getData() });
});

POST endpoint — AI inference

export const POST = withPayment({
amount: "0.005",
description: "AI inference — pay per request",
}, async (req: NextRequest) => {
const { prompt } = await req.json();
const result = await runInference(prompt);
return NextResponse.json({ result });
});

Multiple price tiers

// app/api/basic/route.ts — 0.001 USDC
export const GET = withPayment({ amount: "0.001" }, basicHandler);
// app/api/premium/route.ts — 0.01 USDC
export const GET = withPayment({
amount: "0.01",
payTo: "0xYourWallet",
description: "Premium tier",
}, premiumHandler);
// app/api/enterprise/route.ts — 0.1 USDC
export const GET = withPayment({
amount: "0.1",
description: "Enterprise data feed",
}, enterpriseHandler);

Ready to build?

Start accepting USDC micropayments on Arc. List on the marketplace and let AI agents find you.

Submit to Marketplace →View on GitHub ↗@conduit_pay ↗
Built on Arc Network · Powered by Circle USDC@ace_won/x402 v1.0.2