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

paylio

v0.1.3

Published

Node.js/TypeScript client library for the Paylio API

Readme

Paylio Node.js SDK

npm version CI

The Paylio Node.js SDK provides convenient access to the Paylio API from applications written in server-side JavaScript and TypeScript.

Documentation

See the Paylio API docs.

Requirements

  • Node.js 18+

Installation

npm install paylio

Usage

TypeScript

import { PaylioClient } from "paylio";

const client = new PaylioClient("sk_live_xxx");

// Retrieve current subscription
const sub = await client.subscription.retrieve("user_123");
console.log(sub.status);       // "active"
console.log(sub.plan.name);    // "Pro Plan"
console.log(sub.plan.amount);  // 999

client.close();

JavaScript (CommonJS)

const { PaylioClient } = require("paylio");

const client = new PaylioClient("sk_live_xxx");
const sub = await client.subscription.retrieve("user_123");
console.log(sub.status);
client.close();

List subscription history

const history = await client.subscription.list("user_123", {
  page: 1,
  pageSize: 10,
});

for (const item of history.items) {
  console.log(item.plan_name, item.status);
}

console.log(history.hasMore);

Cancel a subscription

// Cancel at end of billing period (safe default)
const result = await client.subscription.cancel("sub_uuid");
console.log(result.success);

// Cancel immediately
await client.subscription.cancel("sub_uuid", { cancelNow: true });

Configuration

const client = new PaylioClient("sk_live_xxx", {
  baseUrl: "https://custom-api.example.com/v1",
  timeout: 60_000, // 60 seconds
});

Error handling

import {
  PaylioClient,
  AuthenticationError,
  NotFoundError,
  RateLimitError,
  PaylioError,
} from "paylio";

const client = new PaylioClient("sk_live_xxx");

try {
  await client.subscription.retrieve("user_123");
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error("Invalid API key:", error.message);
  } else if (error instanceof NotFoundError) {
    console.error("Subscription not found:", error.message);
  } else if (error instanceof RateLimitError) {
    console.error("Rate limited, try again later");
  } else if (error instanceof PaylioError) {
    console.error(`API error ${error.httpStatus}: ${error.message}`);
  }
}

client.close();

Error types

| Error | HTTP Status | Description | |-------|-------------|-------------| | AuthenticationError | 401 | Invalid or missing API key | | InvalidRequestError | 400 | Bad request parameters | | NotFoundError | 404 | Resource not found | | RateLimitError | 429 | Rate limit exceeded | | APIError | 5xx | Server error | | APIConnectionError | — | Network or connection failure |

All errors extend PaylioError, which extends Error.

Development

npm install
npm test
npm run typecheck
npm run lint

License

MIT