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

@tenderpay/sdk

v0.2.0

Published

Typed SDK for plugins that call Tender.

Readme

@tenderpay/sdk

Typed npm client for EmDash plugin authors that call Tender. Provides request validation, idempotency key generation, and a consumer event-consumption API.

Installation

pnpm install @tenderpay/sdk

Key Features

  • Charge / Refund / Subscription APIs: write surfaces with automatic idempotency keys and bounded retry on transient failures.
  • Context-aware client (createTenderClientFromContext): build an authenticated client straight from an EmDash route context + your settings — no hand-derived token, fetch, or base URL, no route-context casts.
  • Consumer eventing (watchTransaction / fulfillTransaction): learn terminal payment states (paid, refunded, …) by short-polling Tender's authenticated read route, with exponential backoff and at-least-once delivery + dedup. This is the Candidate C transport from ADR 0005; the full consumer contract lives in docs/consumer-eventing.md and the copy-paste quickstart in docs/consumer-integration.md.
  • Durable dedup (createKvDedupStore): KV-backed, restart-safe dedup for the at-least-once contract (the in-memory store is a single-process convenience).
  • Type Safety: fully typed request/response and event interfaces.

Usage

import { createTenderClient } from "@tenderpay/sdk";

const client = createTenderClient({
  baseUrl: "https://your-site.example",
  pluginToken: () => loadAdminScopedToken(), // string or async getter
});

// Create a charge (idempotency key auto-generated).
const result = await client.charge({
  amount: 9_999, // minor units (cents)
  currency: "USD",
  description: "Order #123",
  customerEmail: "[email protected]",
  returnUrl: "https://your-site.example/return",
});

From an EmDash route context (recommended for plugins)

import { createTenderClientFromContext } from "@tenderpay/sdk";

// `ctx` is your sandboxed route context (exposes `http.fetch`); `settings` carries
// `tenderBaseUrl` + an admin-scoped `tenderPluginToken`.
const client = createTenderClientFromContext(ctx, settings);
const result = await client.charge({
  /* …as above… */
});

Consuming payment events (Carte/Dateline)

import { createKvDedupStore, fulfillTransaction } from "@tenderpay/sdk";

await fulfillTransaction(result.transactionId, {
  client,
  delivered: createKvDedupStore(ctx.kv), // DURABLE, restart-safe dedup
  interestingStatuses: ["paid"], // omit to stop on ANY terminal status
  // RETURN the promise so the watcher awaits it before recording the dedup key.
  onEvent: (event) => fulfillOrder(event.transaction), // must be idempotent
});

fulfillTransaction is the canonical charge → poll → fulfill closer; drive it from an in-request entry point (return-URL handler, admin action, or cron-route). See the consumer integration quickstart.

Delivery is at-least-once; consumers MUST dedup on transactionEventDedupKey(event) and react idempotently. See docs/consumer-eventing.md for the full contract (event types, payload schema, versioning).

License

MIT