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

pepay

v0.8.0

Published

Pepay API wrapper for Node.js and browsers

Readme

Pepay Node.js SDK

Pepay's official JavaScript/TypeScript SDK for merchant, commerce, and payment session APIs. It ships with built-in types, ESM + CommonJS builds, request retries, and webhook helpers.

Documentation

  • SDK guides: docs/sdk/overview.md
  • API reference: docs/api-reference/introduction.md

Requirements

  • Node.js 18+ for server integrations
  • Evergreen browsers for client integrations (session token flows)

Installation

npm install pepay
yarn add pepay
pnpm add pepay

Quickstart (server)

import { Pepay } from 'pepay';

const pepay = new Pepay({
  apiKey: process.env.PEPAY_API_KEY,
  baseUrl: 'https://api-beta.pepay.io',
  environment: 'devnet'
});

const invoice = await pepay.invoices.create({
  amount_usd: 49.99,
  description: 'Starter plan'
});

console.log(invoice);

Authentication

Pepay supports multiple auth contexts. Choose the one that matches your surface:

  • apiKey -> x-api-key (merchant scope)
  • commerceApiKey -> x-commerce-api-key (commerce scope)
  • bearerToken -> Authorization: Bearer <jwt> (dashboard/merchant JWT)
  • userAccessToken -> User-Authorization: Bearer <token> (commerce user routes)
  • sessionToken + signature -> x-session-token + x-signature (payor/session APIs)

Create separate clients or use withAuth() to scope credentials per use case.

Configuration

const pepay = new Pepay({
  apiKey: process.env.PEPAY_API_KEY,
  baseUrl: 'https://api-beta.pepay.io',
  environment: 'devnet',
  timeoutMs: 30_000,
  maxRetries: 2
});

Common options:

  • baseUrl and environment select the API host and network context.
  • timeoutMs, maxRetries, retryableStatusCodes, and retry tune retry behavior.
  • telemetry, appInfo, and userAgent customize request metadata.

Browser usage

Server API keys are blocked by default in browsers. Use session tokens or WS tokens for client apps.

If you must allow server keys in a browser for internal tools, set:

const pepay = new Pepay({ apiKey, allowServerKeysInBrowser: true });

Webhooks

Verify webhook signatures with the built-in helpers:

import { verifyWebhookSignature } from 'pepay';

const result = await verifyWebhookSignature({
  rawBody,
  headers: request.headers,
  secret: process.env.PEPAY_WEBHOOK_SECRET
});

if (!result.valid) {
  throw new Error(`Invalid webhook signature: ${result.reason}`);
}

Pass the raw request body bytes to ensure signature verification succeeds.

WebSocket events

Mint a short-lived WS token server-side, then connect:

const token = await pepay.ws.token.mint({ scope: 'merchant', ttlSeconds: 300 });
const stream = pepay.ws.connectMerchantEvents({ token, types: 'invoice.*' });

stream.on('event', (event) => {
  console.log(event.id, event.type);
});

Retries and timeouts

Pepay retries eligible requests with exponential backoff. Configure:

  • maxRetries to control attempts.
  • retryMaxElapsedMs to cap total retry time.
  • retryableStatusCodes to override default retryable status codes.

Per-request overrides are available via request options, including timeoutMs and idempotencyKey.

Errors

The SDK throws typed errors with API metadata:

  • PepayAuthError
  • PepayRateLimitError
  • PepayValidationError / PepayInvalidCursorError
  • PepayHttpError
  • PepayCircuitBreakerError
  • PepayPollingTimeoutError

Resources

The client exposes typed resources for: invoices, tokens, commerce, events, ws, access, wallets, settlement, paymentSessions, apiKeys, and merchantSettings.

Changelog

See CHANGELOG.md for release notes.

Support

Email [email protected] for access or onboarding help.