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

@syra-ai/x402-payer

v0.1.1

Published

Lightweight x402 v2 payment helper — sign PAYMENT-SIGNATURE, auto-retry on 402, and safe double-charge detection for Syra or any x402 HTTP API.

Downloads

193

Readme

@syra-ai/x402-payer

Lightweight x402 v2 payment helper

Sign · retry · safe double-charge detection — for Syra or any x402 HTTP API

npm version License: MIT Docs API

Docs · x402 discovery · Agent guide · GitHub


What this package does

@syra-ai/x402-payer is a small, MIT-licensed helper for HTTP 402 / x402 v2 flows:

  1. Call a paid endpoint
  2. On 402, read payment requirements
  3. Call your signPayment callback → get PAYMENT-SIGNATURE
  4. Retry the request
  5. Treat “Payment was NOT charged” responses as safe to retry (no double-billing)

Use it when you want payment plumbing without the full @syra-ai/sdk client.

For agents: wire signPayment to @x402/svm, @x402/evm, or your wallet. Discovery: /.well-known/x402.


Install

npm install @syra-ai/x402-payer

Requirements: Node.js ≥ 18
Dependencies: none (you bring the signer)


Usage

import { fetchWithX402Payment, microUsdcToUsd } from "@syra-ai/x402-payer";

const result = await fetchWithX402Payment(
  "https://api.syraa.fun/signal?token=solana",
  { method: "GET", headers: { Accept: "application/json" } },
  {
    async signPayment(requirement) {
      // Wire to @x402/svm, @x402/evm, or your wallet
      const amountUsd = microUsdcToUsd(requirement.amount);
      console.log("Paying", amountUsd, "USDC on", requirement.network);
      return "..."; // PAYMENT-SIGNATURE header value
    },
  },
);

if (result.ok) {
  console.log(result.data);
} else {
  console.error(result.error);
}

API

| Export | Description | |--------|-------------| | fetchWithX402Payment(url, init, options) | Fetch with 402 → sign → retry | | microUsdcToUsd(amount) | Convert micro-USDC integer to USD number |

signPayment(requirement)

Your callback receives the x402 payment requirement from the 402 response and must return the PAYMENT-SIGNATURE header string.


Safe retry

Responses containing "Payment was NOT charged" are treated as safe to retry — the helper will not assume a successful charge, reducing double-billing risk.


When to use which package

| Package | Use when | |---------|----------| | @syra-ai/x402-payer | You only need sign + retry around raw fetch | | @syra-ai/sdk | Full Syra client (routes, pillars, auto-pay factories) | | @syra-ai/mcp-server | Cursor / Claude MCP tools — npx -y @syra-ai/mcp-server |


Links

| Resource | URL | |----------|-----| | Syra API | api.syraa.fun | | x402 discovery | api.syraa.fun/.well-known/x402 | | Agent docs | api.syraa.fun/llms-full.txt | | Human docs | docs.syraa.fun | | Source | github.com/ikhwanhsn/syra_agent |


License

MIT © Syra