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

@pr402/buyer-typescript

v1.0.0

Published

TypeScript payment rail for X402 + pr402 exact flow — fetch wrapper and Solana signing helpers

Readme

@pr402/buyer-typescript

TypeScript payment rail for X402 and pr402 (exact scheme). Sign Solana transactions, build PAYMENT-SIGNATURE proofs, and wrap fetch for one-shot 402 retry — without marketplace or Forge APIs.

For http402 Forge (listings, buy, publish, vault), use @http402/forge-client instead.

Install

npm install @pr402/buyer-typescript

Requires Node.js 18+ (global fetch) or pass a compatible fetch to the helpers that accept it.

Subpath imports

| Import | Purpose | | :--- | :--- | | @pr402/buyer-typescript | Main entry — defaults, exact flow, createPay402Fetch, X402Client | | @pr402/buyer-typescript/fetch-with-payment | createPay402Fetch only | | @pr402/buyer-typescript/pr402-defaults | Facilitator URLs and accepts[] helpers | | @pr402/buyer-typescript/pr402-exact-flow | buildExactPaymentProofJsonString and types |

CommonJS and ESM consumers are supported via require and import export conditions.

Quick start

One-click fetch wrapper

import {
  createPay402Fetch,
  PR402_FACILITATOR_URL_PREVIEW,
} from '@pr402/buyer-typescript';
import { Keypair } from '@solana/web3.js';

const payer = Keypair.fromSecretKey(/* your secret key bytes */);
const payFetch = createPay402Fetch(fetch, {
  payer,
  defaultFacilitatorBaseUrl:
    process.env.PR402_FACILITATOR_URL ?? PR402_FACILITATOR_URL_PREVIEW,
});

const res = await payFetch('https://preview.example.com/api/resource', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ /* ... */ }),
});

High-level client

import { X402Client, PR402_FACILITATOR_URL_PREVIEW } from '@pr402/buyer-typescript';
import { Keypair } from '@solana/web3.js';

const client = new X402Client({
  payer: Keypair.fromSecretKey(/* ... */),
  defaultFacilitatorBaseUrl: PR402_FACILITATOR_URL_PREVIEW,
});

const data = await client.buy('https://preview.example.com/api/resource', {
  query_type: 'daily',
});

Facilitator URLs

| Environment | Default | | :--- | :--- | | Preview (Devnet) | https://preview.ipay.sh | | Production (Mainnet) | https://ipay.sh |

Override with PR402_FACILITATOR_URL or pass defaultFacilitatorBaseUrl in client options.

Source repo

Developed in the x402-buyer-starter monorepo under typescript/. Demos and Forge examples live there; this npm package ships payment artifacts only.

License

Apache-2.0 — see LICENSE.