Skip to content

ryzeagent/x402-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

x402-express

Express middleware for x402 HTTP micropayment gating.

Drop-in payment layer for any Express API — routes return 402 Payment Required until USDC is settled.

Install

npm install x402-express

Usage

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

const app = express();

app.get("/api/data",
  x402Gate({ price: 0.005, payTo: "0xYour...", description: "Data feed" }),
  (req, res) => res.json({ data: "protected" })
);

API

x402Gate(options)

Option Type Description
price number Price in USD
payTo string EVM address to receive payment
asset string USDC contract address (default: Base USDC)
network string Chain ID (default: eip155:8453)
description string Human-readable description

License

MIT

About

Express middleware for x402 HTTP micropayment gating

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors