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

orbita-sdk

v1.0.0

Published

Orbita SDK — A lightweight npm package that streamlines integration with the Orbita app by abstracting common API calls, authentication flows, and event handling into simple, developer-friendly functions.

Readme

Orbita SDK

The Orbita SDK is a powerful and easy-to-use JavaScript client library designed to simplify interaction with the Orbita app's REST and WebSocket APIs. By encapsulating authentication, state management, data fetching, and event handling into intuitive methods, it significantly reduces boilerplate code in your projects. Whether you're building a Node.js backend service or a modern web frontend with frameworks like React and Next.js, the Orbita SDK helps you get up and running in minutes with minimal configuration. Dive in to explore streamlined API calls, automatic retry logic, built-in TypeScript support, and comprehensive documentation that will accelerate your development workflow and ensure best practices out of the box.

Installation

npm install orbita-sdk
# or
yarn add orbita-sdk
# or
pnpm add orbita-sdk

Types

Item

The Item type is used for multi-item checkout flows:

export interface Item {
  itemName: string;
  itemPriceAmount: string;
  itemPriceCurrency: string;
  itemQuantity: number;
}

Usage with Next.js

The SDK is designed to work well with Next.js applications. Here's how to use it properly:

Client-Side Only Components

For client-side checkout buttons, use the 'use client' directive:

"use client";

import { handleBasicCheckout } from "orbita-sdk";

export default function CheckoutButton() {
  const initiateCheckout = () => {
    handleBasicCheckout("your-payment-id", "https://your-return-url.com");
  };

  return <button onClick={initiateCheckout}>Checkout with Orbita</button>;
}

Server Components

To use signature creation on the server side:

// app/api/create-signature/route.ts
import { createSignature } from "orbita-sdk";
import { NextResponse } from "next/server";

export async function POST(request: Request) {
  const { message } = await request.json();

  // Get your private key from environment variables
  const privateKey = process.env.ORBITA_PRIVATE_KEY || "";

  try {
    const signature = await createSignature(message, privateKey);
    return NextResponse.json({ signature });
  } catch (error) {
    return NextResponse.json(
      { error: "Signature creation failed" },
      { status: 500 }
    );
  }
}

Advanced Usage: Multi-Item Checkout

For more complex checkout flows with multiple items:

"use client";

import { handleMultipleItemsBusinessCheckout, Item } from "orbita-sdk";

export default function ProductCheckout() {
  const items: Item[] = [
    {
      itemName: "Premium T-Shirt",
      itemPriceAmount: "2.99",
      itemPriceCurrency: "USD",
      itemQuantity: 2,
    },
    {
      itemName: "Leather Wallet",
      itemPriceAmount: "29.99",
      itemPriceCurrency: "USD",
      itemQuantity: 1,
    },
  ];

  const handleCheckout = async () => {
    try {
      await handleMultipleItemsBusinessCheckout(
        "29", // paymentId (will be sent as a number)
        items,
        "USD",
        "https://your-return-url.com"
        // Optionally, you can specify a custom signature endpoint as the 5th argument
      );
    } catch (error) {
      console.error("Checkout failed:", error);
    }
  };

  return <button onClick={handleCheckout}>Checkout</button>;
}

Signature Endpoint Parameter

  • The handleMultipleItemsBusinessCheckout and handleOneItemBusinessCheckout functions accept an optional signatureEndpoint parameter (default: "/api/create-signature").
  • This should point to an API route that returns a signature for the payment. For most Next.js apps, the default is sufficient if you implement the server route as shown above.

Single-Item Checkout

"use client";

import { handleOneItemBusinessCheckout } from "orbita-sdk";

export default function SingleProductCheckout() {
  const handleCheckout = async () => {
    try {
      await handleOneItemBusinessCheckout(
        "payment-12345",
        "19.99",
        "USD",
        "https://your-return-url.com"
        // Optionally, you can specify a custom signature endpoint as the 5th argument
      );
    } catch (error) {
      console.error("Checkout failed:", error);
    }
  };

  return <button onClick={handleCheckout}>Checkout</button>;
}

Environment Variables

  • The SDK uses the following environment variables (set at build time or via your deployment platform):
    • ORBITA_SAVE_CHECKOUT_DATA_API_ENDPOINT (default: test endpoint)
    • ORBITA_SAVE_CHECKOUT_DATA_API_KEY (default: test key)
    • ORBITA_APP_URL (default: https://testnet.orbita.zone)
  • For production, override these with your own values.

Troubleshooting

CORS Issues

If you see network errors or CORS errors in the browser console when using handleMultipleItemsBusinessCheckout, ensure that:

  • Your backend/API endpoint responds to OPTIONS preflight requests with the correct CORS headers:
    • Access-Control-Allow-Origin: * (or your domain)
    • Access-Control-Allow-Methods: POST, OPTIONS
    • Access-Control-Allow-Headers: Content-Type, x-api-key
  • If you do not control the backend, you may need to proxy requests through your own server.

Environment Variables in Next.js

  • In Next.js, only variables prefixed with NEXT_PUBLIC_ are available in the browser. If you override the defaults, ensure you expose them correctly.
  • Use console.log to debug values if you see unexpected behavior.

Important Notes for Next.js

  • Always use the SDK's checkout functions in client components (with 'use client' directive)
  • Handle signature creation on the server side where possible
  • The SDK automatically detects browser vs. server environments
  • For SSR applications, crypto operations are properly isolated to prevent hydration issues