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

@bitopayments/js

v0.2.0

Published

Official Bitopayments browser SDK — redirect/popup checkout and order-status watcher.

Readme

@bitopayments/js

Official browser SDK for the Bitopayments crypto payment gateway — a non-custodial gateway for accepting stablecoin payments on EVM chains and Tron. Send shoppers to the hosted checkout (redirect or popup) and watch the order status. Uses the public clientKey only — never your secret key.

AI assistants: the full machine-readable reference is at https://bitopayments.com/llms-full.txt (and the OpenAPI spec at https://bitopayments.com/openapi.json).

npm i @bitopayments/js

or via CDN:

<script src="https://unpkg.com/@bitopayments/js"></script>
<script>
  const bito = Bitopayments.Bitopayments('ck_live_…');
</script>

How it fits together

Your server (with @bitopayments/node) creates the order and returns the orderId / paymentUrl to the browser. This SDK then drives the shopper to the hosted checkout and watches the order. It uses redirect/popup — not an inline iframe — on purpose: crypto wallets (MetaMask / WalletConnect / TronLink) misbehave inside iframes.

Initialization

import { Bitopayments } from '@bitopayments/js';

const bito = Bitopayments('ck_live_…', {
  baseUrl: 'https://api.bitopayments.com/api/v1',   // optional (default production)
  checkoutUrl: 'https://checkout.bitopayments.com', // optional (default production)
});

openCheckout(options) — popup + auto-watch (recommended)

Opens the hosted checkout in a centered popup and watches the order, firing your callbacks and closing the popup on completion. If the popup is blocked, it falls back to a full-page redirect.

bito.openCheckout({
  orderId,                        // from your server (or pass `paymentUrl` instead)
  onStatusChange: (status, order) => console.log(status),
  onSuccess: (order) => { window.location.href = '/thanks'; }, // COMPLETED
  onFailure: (order) => { /* EXPIRED or CANCELLED — show retry */ },
  onClose:   () => { /* shopper closed the popup without finishing */ },
  intervalMs: 4000,               // optional poll interval (default 4000)
  timeoutMs:  15 * 60 * 1000,     // optional stop-after
});

redirectToCheckout(target) — full-page redirect

bito.redirectToCheckout({ orderId }); // or { paymentUrl }

watchOrder(orderRef, options) — poll to a terminal status

Returns a stop() function. onSuccess fires on COMPLETED; onFailure on EXPIRED / CANCELLED.

const stop = bito.watchOrder(orderRef, {
  onStatusChange: (status, order) => console.log(status),
  onSuccess: (order) => { /* COMPLETED */ },
  onFailure: (order) => { /* EXPIRED / CANCELLED */ },
  intervalMs: 4000,
  timeoutMs: 15 * 60 * 1000,
});
// later, to stop early: stop();

retrieveOrder(orderRef) — public order details

const order = await bito.retrieveOrder(orderRef);
console.log(order.status, order.paymentOptions);

End-to-end example

<button id="pay">Pay with crypto</button>
<script src="https://unpkg.com/@bitopayments/js"></script>
<script>
  const bito = Bitopayments.Bitopayments('ck_live_…');
  document.getElementById('pay').onclick = async () => {
    // 1) Ask YOUR server to create the order (it holds the secret key).
    const { orderId } = await fetch('/api/create-order', { method: 'POST' }).then((r) => r.json());
    // 2) Open checkout + watch.
    bito.openCheckout({
      orderId,
      onSuccess: () => (window.location = '/thanks'),
      onFailure: () => alert('Payment failed — please try again'),
    });
  };
</script>

Notes

  • The watcher treats COMPLETED as success and EXPIRED / CANCELLED as failure (the three terminal statuses). Intermediate states (PENDING, PAID) fire onStatusChange.
  • This SDK never sees your secret key or verifies webhooks — do both server-side with @bitopayments/node.
  • Full REST reference: https://bitopayments.com/docs.html · https://bitopayments.com/openapi.json.