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

payagent

v5.0.0

Published

Let AI agents pay for APIs. A fetch wrapper that pays HTTP 402 responses from an ArisPay funding account, inside spend limits that ArisPay enforces.

Readme

payagent

Let AI agents pay for APIs. The ArisPay SDK and CLI.

payagent is a fetch wrapper. When a seller answers HTTP 402 with an arispay-fiat offer, payagent pays it from your ArisPay funding account and repeats the request. ArisPay enforces the agent's limits: per transaction, per day, per month, and by domain. Currencies: EUR, GBP, USD.

A 402 that has no arispay-fiat offer is not paid. The call throws InvalidRequirementsError.

Install

npm install payagent

Requires Node.js >= 18.

Quick start (CLI)

# 1. Create an account and an agent. No browser is necessary.
npx payagent quickstart --email [email protected]

# 2. Pay a paid API.
npx payagent pay https://api.example.com/premium

quickstart saves the developer key and the agent key to ~/.payagent/config.json. The MCP server @arispay/payagent-mcp reads the same file.

Add money to your funding account before the first payment. Open the ArisPay dashboard and top up by card.

Quick start (library)

import { bootstrapAgent } from "payagent";

const agent = await bootstrapAgent({ email: "[email protected]" });
const res = await agent.fetch("https://api.example.com/premium");

With an agent key that you already have:

import { payFetchDelegated } from "payagent";

const pay = payFetchDelegated({
  arispayUrl: "https://api.arispay.app",
  apiKey: process.env.ARISPAY_AGENT_KEY!,
  idempotencyKey: "order-1234", // optional, makes a retry safe
  onPayment: (info) => console.log(info.amountCents, info.remainingDaily),
});
const res = await pay("https://api.example.com/premium");

onPayment fires after ArisPay authorizes the payment, when the server sends the spend data. All amounts are integer cents.

How a payment works

  1. payagent sends your request.
  2. The seller answers 402 with an arispay-fiat offer: merchant, currency, amount in cents.
  3. payagent calls POST /v1/fiat/authorize at your arispayUrl. ArisPay checks the agent, its limits, its allowed domains and the balance, then returns a single-use authorization.
  4. payagent repeats the request with the authorization in X-PAYMENT.
  5. The seller settles the authorization at ArisPay, then serves the response.

payagent never calls the authorizeEndpoint that a seller names. It calls only your configured arispayUrl.

Errors

| Error | Meaning | |---|---| | InvalidRequirementsError | The 402 could not be read, or it has no arispay-fiat offer. | | PaymentRejectedError | ArisPay refused to authorize, or the seller rejected the payment. | | PaymentUndeliveredError | The seller took the payment and then failed. You were charged. |

PaymentUndeliveredError has paymentId and safeRetry. When safeRetry is true, repeat the request with the same idempotencyKey inside 10 minutes: the seller serves it again and does not charge again. When it is false, a repeat pays again. A fiat payment can be refunded.

Manage agents

import { DelegationClient, launchAgent, syncAgents } from "payagent";

const client = new DelegationClient("https://api.arispay.app", process.env.ARISPAY_API_KEY!);

await launchAgent({ name: "hermes", limits: { perTx: 50, daily: 1000, monthly: 10000 } });
await syncAgents();                                   // list from the server
await client.updateAgent(agentId, { suspended: true }); // stop all payments
await client.renameAgent(agentId, "Travel");
await client.rotateX402Key(agentId);                  // new agent key
await client.listAgentPayments(agentId);              // payment history

Limits are integer cents.

CLI

payagent quickstart --email X     create an account and an agent
payagent init                     pair an existing account in the browser
payagent connect CODE             connect a BuyForMe wallet to this computer
payagent pay URL                  make one paid request
payagent pay-merchant URL ...     create a merchant payment (card, balance, mpp)
payagent agent create|list|rename|remove
payagent user create|get|attach-card|set-limits|status
payagent discover "QUERY"         search the ArisPay marketplace (free)
payagent doctor | whoami | logout

Environment: ARISPAY_API_KEY, ARISPAY_URL, PAYAGENT_CONFIG_DIR, PAYAGENT_NO_UPDATE_CHECK.

Framework tools

import { createPayAgentTool } from "payagent/vercel";    // Vercel AI SDK
import { createPayAgentTool } from "payagent/langchain"; // LangChain

const tool = createPayAgentTool({ arispayUrl: "https://api.arispay.app", apiKey });

Sell an API

Use paygate to put a price on a route. It sends the 402 that payagent pays.

License

MIT