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

@openreceive/http

v0.3.2

Published

Framework-neutral (Web Request/Response) HTTP handler for OpenReceive checkout that builds on @openreceive/node and requires its Node runtime: request routing, host integration, and payment-attempt persistence.

Readme

@openreceive/http

Framework-neutral receive-checkout handler. Its normal form requires service, authorize, and the host integration. Create bodies never accept payer amounts; the host's amountFor hook is the only price authority, and the commit hook appends a payment-attempt row before the invoice is returned.

This package is ESM-only and requires Node >= 22.

createHost({ db, amountFor, onPaid }) builds that host integration on the library-owned payment repository inside the host application's existing database (pg, node:sqlite, better-sqlite3, or a custom adapter). The library owns attempt selection, per-reference commit locking, write-once settlement with first-attempt-only fulfillment, and the pending → settled | expired | failed | attention reconciliation state machine (attention reads as pending on the wire; operators see it only in openreceive_payments.status). onPaid is the settlement hook in both modes: with db it receives PaymentSettlement (reference plus a query that runs inside the settlement transaction); with a custom repository it receives the raw SettlementEvent (paymentHash, paidAt, details). Settlement piggybacks on mounted routes by default through the durable openreceive_meta gate (opportunisticReconcile: false disables, { minIntervalSeconds } tunes); startNotificationWorker is the optional listen-plus-reconcile worker process. A custom PaymentRepository via the payments option is the advanced escape hatch.

It reuses one live attempt per rail, permits new attempts after expiry, and verifies the payment_hash selector belongs to the authorized order. Committed retries use the stored safe checkout snapshot. swapData is never serialized into an HTTP response. OpenReceive never requires a separate database or Redis.

This is the home of the full host-integration surface. The framework adapters (@openreceive/express, @openreceive/fastify, @openreceive/next) re-export only a curated slice — the handler/stack factories, error surface, notification worker, and their options/context/hook types — so anything deeper imports from here (npm run check:public-api pins both surfaces):

  • Handler and stack: createHttpHandler, createStack, their options types, and mapHostRouteError / HttpError / HostError.
  • Host integration: createHost, the SQL repository (createSqlPayments, paymentsSchemaSql), the PaymentRepository contract types, and the settlement hook contexts above.
  • Reconciliation: maybeReconcilePayments (the durable gate pass), reconcileHostPayments, startReconciler, and the shared constants (OPENRECEIVE_ATTEMPT_EXPIRY_GRACE_SECONDS, OPENRECEIVE_RECONCILE_BATCH_SIZE, scan bounds).
  • Rate limiting: createIpRateLimit, resolveClientIp, and IpRateLimitConfig behind the handler's rateLimiting / rateLimitHook options.
  • Generated wire types: the snake_case Wire* request/response body types (WireCheckout, WireCreateCheckoutRequest, WirePaymentCheck, WireError, …), generated from the OpenAPI contract. The adapters re-export these too.

See the root README, the storage guide, and the OpenAPI contract.