npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nexuspay-x402

v1.0.0

Published

NexusPay SDK for x402 - Add payments to any API in 3 lines

Readme

nexuspay-x402

NexusPay for x402 - add payments to any API in 3 lines.

Install

npm install nexuspay-x402

Express Usage

import nexuspay from 'nexuspay-x402';

app.use(nexuspay({
  apiKey: 'np_your_key',
  price: '0.001',
  payTo: '0xYourWallet'
}));

Next.js Usage

import { nexuspayNext } from 'nexuspay-x402';

export async function GET(request: Request) {
  const check = await nexuspayNext(request, {
    apiKey: 'np_your_key',
    price: '0.001',
    payTo: '0xYourWallet'
  });
  
  if (check) return check;
  
  // Your API logic here
  return Response.json({ data: 'Protected content' });
}

How it works

  1. Request comes in
  2. No payment? → 402 returned automatically
  3. Payment header found? → Verified on Base Sepolia
  4. Verified? → API access granted

Built on Base Sepolia. Payments in USDC.

Features

  • ✅ 3-line integration
  • ✅ On-chain payment verification
  • ✅ ERC-20 Transfer event decoding
  • ✅ Works with Express and Next.js
  • ✅ AI agent compatible
  • ✅ TypeScript support

Configuration

interface NexusPayConfig {
  apiKey?: string;     // Optional API key for app-side tracking
  price: string;       // Price in USDC (e.g., '0.001')
  payTo: string;       // Your wallet address
  token?: string;      // Token address (default: USDC)
  network?: string;    // Network (default: 'base-sepolia')
  enabled?: boolean;   // Set false to bypass checks in local dev
  rpcUrl?: string;     // Optional custom RPC URL
}

Payment Header Format

Clients must include payment proof in the X-Payment header:

X-Payment: txHash=0x...;from=0x...;to=0x...;amount=0.001;token=0x...;network=base-sepolia

Example: Protected API

import express from 'express';
import nexuspay from 'nexuspay-x402';

const app = express();

// Protect this route
app.get('/api/data', 
  nexuspay({
    apiKey: 'np_your_key',
    price: '0.001',
    payTo: '0xA1B320D8061357efa286Af2629DF6AC554C05d6E'
  }),
  (req, res) => {
    res.json({ data: 'This is protected content!' });
  }
);

app.listen(3000);

Example: AI Agent Client

// 1. Call API
const response = await fetch('https://api.example.com/data');

// 2. Got 402? Pay with USDC
if (response.status === 402) {
  const { payment } = await response.json();
  
  // Send USDC on Base Sepolia
  const txHash = await sendUSDC(payment.payTo, payment.amount);
  
  // 3. Retry with payment proof
  const response2 = await fetch('https://api.example.com/data', {
    headers: {
      'X-Payment': `txHash=${txHash};from=${myAddress};to=${payment.payTo};amount=${payment.amount};token=${payment.token};network=base-sepolia`
    }
  });
  
  const data = await response2.json();
}

Network Details

  • Network: Base Sepolia (testnet)
  • Chain ID: 84532
  • USDC Contract: 0x036CbD53842c5426634e7929541eC2318f3dCF7e
  • RPC: https://sepolia.base.org

Get Test USDC

Visit: https://www.coinbase.com/faucets/base-ethereum-sepolia-faucet

License

MIT

Backward Compatibility

nexuspay-x402 also exports paygate and paygateNext aliases so older integrations can migrate gradually.

Links

  • x402 Protocol: https://github.com/coinbase/x402
  • NexusPay Docs: https://github.com/dhruvxop19/nexuspay

Built with the x402 protocol by Coinbase.