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

paygate

v7.0.1

Published

Accept payment from AI agents in two lines of code. Gate any Express or Fastify route. Agents pay in fiat (EUR, GBP, USD) through ArisPay.

Downloads

561

Readme

paygate

Accept payment from AI agents in two lines of code. paygate gates an Express or Fastify route. A request without a payment gets 402 Payment Required. An agent pays in fiat (EUR, GBP, USD) from its ArisPay funding account, and ArisPay settles the payment before your handler runs.

You need a merchant account at https://paygate.arispay.app. It gives you a merchantId.

Quick start

npx paygate init --framework express --merchant-id <your-merchant-id> \
  --route /api/data --price 10 --yes
cd paygate-express-seller
npm install && cp .env.example .env && npm start
curl -i localhost:3000/api/data   # HTTP 402 with the price

paygate init writes a small project: a /health route, one paid route, a .env.example, and a README.

| Flag | Meaning | |---|---| | --framework | express or fastify | | --merchant-id | Your merchant id | | --route | Paid route path (default /api/paid) | | --method | GET, POST, PUT or DELETE (default GET) | | --price | Price in integer cents (default 1) | | --currency | EUR, GBP or USD (default USD) | | --directory | Target directory | | --yes | Never prompt | | --dry-run | Print the file plan and write nothing |

Install

npm install paygate

Express and Fastify are optional peer dependencies. Install the one you use.

Express

import express from "express";
import { paygate } from "paygate/express";

const app = express();
const pw = paygate({ merchantId: process.env.PAYGATE_MERCHANT_ID });

app.get("/api/data", pw({ priceCents: 10 }), (req, res) => {
  res.json({ data: "premium content" });
});

// Price in euro, and a price that depends on the request
app.post(
  "/api/analyse",
  pw({ priceCents: (req) => (req.body.deep ? 50 : 10), currency: "EUR" }),
  handler,
);

Put the body parser before paygate when the price reads req.body.

Fastify

import Fastify from "fastify";
import paygate from "paygate/fastify";

const app = Fastify();
await app.register(paygate, { merchantId: process.env.PAYGATE_MERCHANT_ID });

// Price in the route config
app.get("/api/data", { config: { paygate: { priceCents: 10 } } }, async () => ({
  data: "premium content",
}));

// Or in the handler
app.get("/api/premium", async (req, reply) => {
  const { paid } = await req.paygatePay({ priceCents: 25 });
  if (!paid) return reply;
  return { data: "premium content" };
});

How it works

  1. A request arrives with no X-PAYMENT header. paygate answers 402. The body offers one arispay-fiat entry with your merchant id, the currency, and the price in cents.
  2. The agent (for example npx payagent pay <url>) gets a single-use authorization from ArisPay and sends the request again with X-PAYMENT.
  3. paygate settles the authorization at ArisPay (POST /v1/fiat/settle) with the terms of this route. It trusts the answer only when ArisPay echoes the same merchant, currency and amount.
  4. Your handler runs. The response carries an X-Paygate-Receipt header: { "paid": true, "rail": "fiat", "paymentId": "...", "merchant": "..." }. The same object is on req.paygate.

The payment settles before the handler runs, so you never serve an unpaid request. A fiat payment can be refunded at ArisPay.

Re-delivery

If your handler fails after the payment settled, the agent can send the same payment again. ArisPay replays the settlement a few times inside 10 minutes and your handler runs again. The receipt then has replayed: true. If your handler must run once per payment, set redelivery: false. A repeat is then a 402.

Config

paygate(config) and the Fastify plugin options:

| Option | Default | Meaning | |---|---|---| | merchantId | required | Your merchant id | | currency | "USD" | Default price currency: "EUR", "GBP" or "USD" | | redelivery | true | Serve a replayed settlement again | | apiUrl | https://api.arispay.app | ArisPay API URL | | timeout | 30000 | ArisPay call timeout in ms | | discoveryRateLimit | 10 per minute | Limit of unpaid probes per client | | cacheTtlMs | 5 minutes | Manifest cache time |

Route options:

| Option | Meaning | |---|---| | priceCents | Price in integer cents, or a function of the request | | currency | Price currency for this route | | description | Text shown in the 402 | | mimeType | MIME type of the paid response (default application/json) |

Prices are integer cents. priceCents: 10 is 0.10. Never pass a float.

Manifest

The Fastify plugin serves your hosted capability manifest at /.well-known/arispay.json. On Express, mount it yourself:

import { arispayManifest } from "paygate/express";
app.get("/.well-known/arispay.json", arispayManifest(config));

Version 7

Version 7 accepts fiat only. It removes the stablecoin rail, the wallet / network / price config, and the wrap, register, verify and doctor commands. See CHANGELOG.md.

License

MIT