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

@gomani/pay

v0.7.0

Published

Mobile-money-first payments: a provider-agnostic, idempotent, offline-tolerant payment abstraction.

Readme

@gomani/pay

Mobile-money-first, provider-agnostic payments for Gomani (P9/P10). Payments are an integrated, pre-optimised concern: an idempotent, offline-tolerant engine over a pluggable PaymentProvider, a web-standard endpoint to mount, and low-literacy UI primitives — with mobile money (USSD / STK-push, deep links) as the first-class case and cards secondary.

Posture: pass-through. The app holds no funds and never touches card data — money moves between the payer and the provider, and KYC / fraud / settlement / licensing are the provider's job. Compliance rests with the developer and their provider; Gomani carries the integration burden.

The guarantee

The idempotency key is the contract: the same key is the same payment forever. A dropped connection mid-payment can be retried freely and will never double-charge or lose state, because:

  1. the record is persisted before the provider is called (a crash leaves a recoverable intent);
  2. a repeated initiate with a known key reconciles rather than re-charging;
  3. a terminal state is final — a replayed webhook or a late status poll is a no-op, so the fulfilment hook fires exactly once.

Server (@gomani/pay)

import {
  createPaymentEngine,
  createPaymentHandler,
  createMockProvider, // swap for createMobileMoneyProvider({ baseUrl, apiKey, webhookSecret })
} from '@gomani/pay';

const engine = createPaymentEngine({
  provider: createMockProvider(),
  onTransition: (record) => {
    if (record.status === 'succeeded') grantAccess(record.reference); // fires once
  },
});

// In app/server.ts — mounts /_gomani/pay/{initiate,status,webhook}:
const pay = createPaymentHandler(engine);
export default (request: Request) => pay(request);

Providers: createMockProvider (local default, for dev/tests — simulates a USSD/STK approval and can mint signed webhooks), createMobileMoneyProvider (a generic STK-push/USSD adapter scaffold), and createAggregatorProvider (a corridor-collapsing adapter that routes by MSISDN prefix). Real endpoints and secrets are configuration; fetch is injected via the provider context.

Bring your own storage by implementing PaymentStore (an in-memory one ships; Postgres is a drop-in).

Client (@gomani/pay/client)

import { createPaymentClient, PaymentStatusView } from '@gomani/pay/client';

const client = createPaymentClient(); // talks to /_gomani/pay
client.pay({
  amount: { amount: 150000, currency: 'MWK' },
  reference: order.id,
  customer: { phone },
});
// render PaymentStatusView({ record: client.payment.value }) in a reactive region

createPaymentClient derives a stable idempotency key from the order reference (persisted before the first request), initiates, and polls status until the payment settles — pausing while offline and resuming when connectivity returns. PaymentStatusView renders the low-literacy status card, including a big tap-to-dial USSD code when the payer must act.

See examples/shop for a complete checkout.