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

@pickforge/billing

v0.9.0

Published

UI-free Stripe billing and credit-ledger helpers for Pickforge apps.

Readme

@pickforge/billing

UI-free Stripe billing and credit-ledger helpers for Pickforge apps.

import { createCreditCheckoutSession } from "@pickforge/billing";

const session = await createCreditCheckoutSession({
  stripe,
  userId,
  priceId,
  successUrl,
  cancelUrl,
});
import { processStripeEvent, verifyStripeEvent } from "@pickforge/billing";

const event = await verifyStripeEvent({
  payload,
  signature,
  secret: stripeWebhookSecret,
  stripe,
});

const result = await processStripeEvent({
  supabase: serviceRoleSupabase,
  stripe,
  event,
});

Prerequisites: apply the billing and checkout lifecycle migrations first, use a service-role Supabase client for processStripeEvent, and call verifyStripeEvent before processStripeEvent; processing trusts the verified event input.

The credit ledger is the source of truth for balance; balances are sums of ledger rows. General refunds remain manual v1 operator adjustments. The lifecycle invariant separately issues an idempotent full refund when a Checkout Session completes after account deletion has been fenced or its user is already missing, and never grants credits in either path. Pending or action-required Refunds keep deletion fenced and retryable until signed Refund events establish aggregate success. Signed events are matched to the durably stored Refund id; processing inspects the PaymentIntent’s aggregate Refund history, blocks while another Refund is nonterminal, and automatically continues any succeeded shortfall by refunding exactly the remaining amount with a persisted attempt-specific idempotency key. Attached Refunds are recoverable after crashes, unknown Refunds are ignored, and lifecycle becomes terminal only after cumulative succeeded Refunds cover the full Checkout amount. If an owned Refund later transitions from succeeded to failed or canceled, compensation atomically reopens and claims the next recovery attempt even after auth/customer deletion. checkout.session.async_payment_failed terminalizes the registered Session as non-credit payment_failed. Missing-user refund success keeps late-customer cleanup durable until the webhook deletes the Stripe Customer (or confirms it missing) and clears customer_cleanup_pending; replayed or concurrent cleanup is idempotent. The package is UI-free and secret-free: Stripe is injected, and service-role Supabase clients stay server-side. App UI, offline behavior, and purchase presentation stay in app repos.