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

@kilnjs/payments-stripe

v0.1.3

Published

Stripe for KilnJS: webhook signatures verified and purchases normalised, over the HTTP API and no SDK

Readme

@kilnjs/payments-stripe

Stripe for KilnJS, over its HTTP API and nothing else. No SDK: what this needs is an HMAC, two GETs and a vocabulary.

yarn add @kilnjs/payments @kilnjs/payments-stripe
// app.config.ts
import { payments } from "@kilnjs/payments";
import "@kilnjs/payments-stripe";

Importing it registers the provider, after which Payments.stripe is resolvable and typed, and notifications arrive at /payments/stripe already verified.

| option | environment | | | --- | --- | --- | | secretKey | STRIPE_SECRET_KEY | required. Reaches everything the account can do | | webhookSecret | STRIPE_WEBHOOK_SECRET | required. The signing secret for this endpoint, which is a different secret | | tolerance | STRIPE_WEBHOOK_TOLERANCE | 300 seconds. How far out of step a notification may be | | api | STRIPE_API_URL | the API, overridable for a local mock | | timeout | STRIPE_TIMEOUT_MS | 10000. How long Stripe has to answer a lookup |

What verification checks

Three things, and leaving out any one of them is a hole somebody has shipped:

  • the signature, compared in constant time, against any of the signatures in the header, because a rotation means two secrets are live at once;
  • the body it signed, byte for byte, which is why these routes keep the raw body;
  • the timestamp, within tolerance, which is what stops a notification captured once from being replayed forever.

A refusal answers 400, says which shape of problem it was, and never echoes the signature it was given or the secret it expected.

What it maps

| Stripe | kind | | --- | --- | | checkout.session.completed, customer.subscription.created | purchased | | invoice.paid, invoice.payment_succeeded | renewed | | invoice.payment_failed | billing_failed | | customer.subscription.deleted | cancelled | | customer.subscription.paused / resumed | paused / recovered | | charge.refunded, charge.dispute.created | refunded | | anything else | other, with the event whole in raw |

Which of your users this is cannot be inferred: Stripe knows a customer id, not a user. So event.actor.reference is whatever the application asked Stripe to carry for it - client_reference_id on a session, or metadata.userId - and putting something recognisable there is the application's half of the bargain.

A subscription told to stop at the end of its period is reported as active and renewing: false, which is exactly the state a customer has to be told about.

Verifying

yarn verify   # ts:check, lint, build, exports:check, test

Stripe is never reached: a signature is arithmetic, and the lookups are checked by what they send and what they refuse to say in a failure.