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

@usekairo/sdk

v1.0.1

Published

Official TypeScript SDK for Kairo Payment Orchestration

Readme

Kairo SDK (TypeScript/JavaScript)

The official TypeScript SDK for Kairo Payment Orchestration. Integrates cleanly with Node.js, Next.js, and browser environments.

Installation

npm install @kairo/sdk

Usage

Initialize Client

import { Kairo } from "@kairo/sdk";

const kairo = new Kairo({
  apiKey: "pk_dev_xxxxxx",
  // baseUrl: "http://localhost:8080" // Optional: default is https://api.kairo.dev
});

Payments

Create a Payment

try {
  const payment = await kairo.payments.create({
    amount: 1000, // in cents (e.g. 10.00 USD)
    currency: "usd",
    metadata: { orderId: "123" }
  });
  console.log("Payment Created:", payment.id, payment.status);
} catch (err) {
  console.error("Error creating payment:", err);
}

Retrieve a Payment

try {
  const payment = await kairo.payments.retrieve("payment_uuid");
  console.log("Payment details:", payment.id, payment.status, "Refunded:", payment.refunded_amount);
} catch (err) {
  console.error("Error getting payment:", err);
}

Refunds

Create a Refund (Full or Partial)

try {
  const refund = await kairo.refunds.create({
    payment_id: "payment_uuid",
    amount: 500 // Optional: amount in cents for partial refund. Defaults to full amount.
  });
  console.log("Refund details:", refund.id, refund.status, refund.amount);
} catch (err) {
  console.error("Error creating refund:", err);
}

Retrieve a Refund

try {
  const refund = await kairo.refunds.retrieve("refund_uuid");
  console.log("Refund details:", refund);
} catch (err) {
  console.error("Error retrieving refund:", err);
}

List Refunds for a Payment

try {
  const refunds = await kairo.refunds.list("payment_uuid");
  console.log("Refunds list:", refunds);
} catch (err) {
  console.error("Error listing refunds:", err);
}

Usage & Plans

Retrieve API Usage Stats

try {
  const usage = await kairo.usage.get();
  console.log("Usage stats:", usage.payments_used, "/", usage.payment_limit);
} catch (err) {
  console.error("Error getting usage stats:", err);
}

Retrieve API Plan Details

try {
  const plan = await kairo.plan.get();
  console.log("Current Plan:", plan.plan, "Features:", plan.features);
} catch (err) {
  console.error("Error getting plan:", err);
}

Backwards Compatibility

Legacy flat methods remain available but are marked as @deprecated and will be removed in a future major version:

// Legacy style - still functional:
const payment = await kairo.createPayment({ amount: 1000, currency: "usd" });
const fetched = await kairo.getPayment(payment.id);
const refund = await kairo.refund(payment.id);

Error Handling

The SDK exposes specific typed errors mapped from API responses:

import { 
  ValidationError, 
  AuthenticationError, 
  ForbiddenError, 
  NotFoundError, 
  RateLimitError, 
  ServerError, 
  NetworkError 
} from "@kairo/sdk";

try {
  await kairo.payments.create({ amount: 1000, currency: "usd" });
} catch (err) {
  if (err instanceof ValidationError) {
    console.error("Validation error:", err.message);
  } else if (err instanceof AuthenticationError) {
    console.error("Authentication failed:", err.message);
  } else if (err instanceof ForbiddenError) {
    console.error("Forbidden action:", err.message);
  } else if (err instanceof NotFoundError) {
    console.error("Resource not found:", err.message);
  } else if (err instanceof NetworkError) {
    console.error("Network or timeout error:", err.message);
  } else {
    console.error("An unexpected error occurred:", err);
  }
}