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

@pay-normalize/paystack

v0.1.3

Published

Paystack connector for pay-normalize: webhooks and verify-transaction responses.

Readme

@pay-normalize/paystack

Paystack connector — normalizes webhooks and verify-transaction responses into StandardizedTransaction.

Status: production-backed for charge.success (card and bank_transfer channels) — real, captured-and-sanitized webhook deliveries; see fixtures/webhooks/prod.sanitized.*. transfer.success/transfer.reversed/refund.processed are currently backed by docs-derived fixtures. Per NOT_DOING.md §11, each event family graduates independently as real deliveries are donated.

import { paystack } from "@pay-normalize/paystack";

See ../../docs/INTEGRATION.md for the full host flow and ../../docs/SECURITY.md for the signature model.


Signature

  • Header: x-paystack-signature
  • Scheme: HMAC-SHA512 over the raw body, hex, constant-time compared.
  • Secret is your Paystack secret key, passed as an argument.
const ok = paystack.verifyWebhookSignature({ headers: req.headers, rawBody, secret });

Events

parseWebhook(rawBody) routes Paystack's event list:

| Event | Result | Direction / status | |---|---|---| | charge.success | transaction | credit; status from the 8-status vocabulary | | transfer.success / .failed / .reversed | transaction | debit; status encoded by the event name | | refund.processed | transaction | REVERSED on the original charge's dedupeKey | | subscription.*, invoice.*, dispute.*, dedicatedaccount.*, refund.pending/processing/failed, … | unknown_event | recognized, surfaced, never swallowed | | anything else | unknown_event | forward-compatible |

Status vocabulary

Paystack's 8 documented statuses map explicitly (no inference): success → SUCCESSFUL; failed/abandoned → FAILED; reversed → REVERSED; pending/processing/queued/ongoing → PENDING. Anything outside the table becomes a parse_error. abandoned → FAILED combined with the FAILED → SUCCESSFUL rank rule cleanly handles a pay-with-transfer that completes late.

Money

Charge amounts and fees arrive already in kobo (parseKoboInteger). net = amount − fees. Transfer webhooks don't reliably carry the fee, so fee = 0 there and the true fee reconciles from the settlement export (documented, not guessed).

Identity

chargeDedupeKey(reference)paystack:charge:<reference>. A charge and its refund share this key, so the refund lands as a SUCCESSFUL → REVERSED transition. Transfers use paystack:transfer:<reference>.


Verify-before-value

parsePaystackVerification(response) normalizes a GET /transaction/verify/:reference response. It shares the webhook's dedupeKey, so verify-sourced and webhook-sourced rows upsert into one. Money model: amount − fees = requested_amount (the schema invariant is Paystack's arithmetic). This is also the missing-money backfill path when a webhook was never delivered.

const result = parsePaystackVerification(apiResponse);
if (result.kind === "transaction" && result.transaction.status === "SUCCESSFUL") { /* fulfil */ }

Settlement files

parseSettlementFile(buffer) throws UnsupportedFileFormatError (ERR_UNSUPPORTED_FILE_FORMAT) until a sanitized real CSV export exists in fixtures to pin the column layout.


Exports

| Export | Type | |---|---| | paystack | Connector | | verifyPaystackSignature | (input) => boolean | | parsePaystackWebhook | (rawBody) => ParseResult | | parsePaystackVerification | (response) => ParseResult | | chargeDedupeKey | (reference) => string | | SIGNATURE_HEADER | "x-paystack-signature" | | PROVIDER | "paystack" |

Depends on @pay-normalize/core and zod.