Powered by Coinbase x402 Protocol

@viainti/x402

Complete library to integrate HTTP 402 micropayments into your web and AI applications

Zero Fees

0% fees. Keep 100% of your revenue without intermediaries.

Instant Settlement

Payments confirmed in 2 seconds. No waiting.

Frictionless

One line of code. No accounts or registrations.

Multi-Chain

Base, Ethereum, Polygon, Arbitrum, and Optimism.

TypeScript

Complete and safe types throughout the library.

Easy Integration

Middleware, hooks, and UI components included.

Installation

npm
npm install @viainti/x402

Basic Usage - Server

// middleware.ts
import { createX402Middleware } from '@viainti/x402/server'

export const middleware = createX402Middleware({
  recipientAddress: '0xYourAddress',
  routes: {
    '/api/premium': '0.01',  // $0.01 per request
  },
})

Basic Usage - Client

// Client with automatic payment
import { X402Client } from '@viainti/x402/client'

const client = new X402Client({
  privateKey: 'your-wallet-private-key',
})

const response = await client.fetch('/api/premium')
const data = await response.json()

Use Cases

Pay-Per-Use APIs

Monetize your APIs by charging per request. Perfect for translation, image generation, and data processing services.

Premium Content

Create paywalls for articles, videos, and courses. Users pay only for what they consume.

AI Agents

AI agents that automatically pay for external services without human intervention.

Microservices

Monetize internal microservices and create service marketplaces within your organization.

© 2025 ViaInti. All rights reserved.