x402 Protocol // Circle Gateway

ARC Testnet
Facilitator

Open facilitator for the x402 HTTP payment protocol on ARC Testnet. Drop-in middleware for any Express app — charge per request in USDC.

● eip155:5042002 USDC / ARC Testnet Circle Gateway SDK x402 spec v2
payment-flow.diagram
Network Details

ARC Testnet Configuration

Use these values when configuring sellers or buyers on the ARC testnet.

Facilitator URL
https://x402-arc.krutovoy.me
Network ID
eip155:5042002
Chain ID
5042002
USDC Contract
0x3600000000000000000000000000000000000000
GatewayWallet Contract
0x0077777d7eba4688bdef3e311b846f25870a19b9
RPC Endpoint
https://rpc.testnet.arc.network
Integration

Quick Start

Three paths to integrate x402 payments.

Add payment-gated endpoints to any Express app using Circle's Gateway SDK.

import { createGatewayMiddleware } from '@circlefin/x402-batching/server'; import express from 'express'; const app = express(); // Initialize with your wallet + this facilitator const gateway = createGatewayMiddleware({ sellerAddress: '0xYOUR_WALLET_ADDRESS', facilitatorUrl: 'https://x402-arc.krutovoy.me', }); // Charge $0.001 USDC per request app.get('/api/data', gateway.require('$0.001'), (req, res) => { res.json({ data: 'paid content', payer: req.payment.payer, }); }); app.listen(3000);

Install: npm install @circlefin/x402-batching express
The SDK handles 402 response, payment verification, and settlement automatically.

Pay x402-protected endpoints using the Gateway client. One-time USDC deposit, then pay any endpoint.

import { GatewayClient } from '@circlefin/x402-batching/client'; // Initialize with your private key on ARC testnet const client = new GatewayClient({ chain: 'arcTestnet', privateKey: '0xYOUR_PRIVATE_KEY', }); // One-time setup: deposit USDC to Gateway contract await client.deposit('1'); // 1 USDC // Pay and fetch any x402-protected endpoint const { data } = await client.pay('https://your-api.com/api/data'); console.log(data); // { data: 'paid content', payer: '0x...' }

Get testnet USDC from the Circle Faucet → select Arc Testnet.

Test the facilitator directly with curl. Useful for debugging or building custom clients.

1. Check supported networks
curl https://x402-arc.krutovoy.me/supported | jq .
2. Health check
curl https://x402-arc.krutovoy.me/health | jq . # → { "status": "ok", "uptime": 3600, "networks": 12 }
3. Verify a payment payload
curl -X POST https://x402-arc.krutovoy.me/verify \ -H "Content-Type: application/json" \ -d '{ "paymentPayload": { ... }, "paymentRequirements": { "network": "eip155:5042002", "asset": "0x3600000000000000000000000000000000000000", "payTo": "0xYOUR_WALLET", "amount": "1000" } }'
Reference

API Endpoints

All endpoints are public — no authentication required. Click to expand.

GET /supported Supported payment networks

Returns list of supported payment networks and their configurations.

Response
{ "kinds": [ { "network": "eip155:5042002", "asset": "0x3600000000000000000000000000000000000000", "scheme": "gateway" }, // ... 11 more networks ] }
GET /health Liveness probe

Returns facilitator status, uptime, and network count. Use for monitoring.

Response
{ "status": "ok", "uptime": 3600, "networks": 12, "version": "1.0.0" }
POST /verify Verify payment payload

Validates a payment payload against the Circle Gateway. Called by seller middleware before granting access.

Request body
{ "paymentPayload": { /* x402 payment header, base64-decoded */ }, "paymentRequirements": { "network": "eip155:5042002", "asset": "0x3600000000000000000000000000000000000000", "payTo": "0xSELLER_ADDRESS", "amount": "1000" // in base units (6 decimals for USDC) } }
Response
{ "isValid": true, "payer": "0xBUYER_ADDRESS", "invalidReason": null }
POST /settle Settle verified payment

Executes the on-chain settlement after successful verification. Called by seller middleware after responding to buyer.

Request body
{ "paymentPayload": { /* same payload from /verify */ }, "paymentRequirements": { /* same requirements from /verify */ } }
Response
{ "success": true, "payer": "0xBUYER_ADDRESS", "txHash": "0x...", "errorReason": null }
Troubleshooting

Common Errors

Most issues are due to insufficient balance or incorrect network configuration.

Error Cause Fix
isValid: false Payment payload invalid or expired Retry — payloads expire in ~30s
insufficient balance Buyer has no USDC in GatewayWallet Get testnet USDC from Circle Faucet, then deposit
network mismatch paymentRequirements.network wrong Use eip155:5042002 for ARC testnet
unsupported network Network not in /supported list Check /supported — use exact network string
500 Internal Error RPC or Gateway SDK error Check /health, retry in 5s