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_hash

v1.0.8

Published

PayHash SDK is a professional TypeScript library designed to streamline blockchain payments, receipt generation, and automated email notifications

Readme

PayHash SDK

PayHash SDK is a professional TypeScript library designed to streamline blockchain payments, receipt generation, and automated email notifications. Built on top of viem, it provides a high-level interface for handling crypto transactions on the Tempo network, while automatically generating PDF receipts and sending them to both organizations and clients via SMTP.

Key Features

  • Seamless Payments: Process single or batch token transfers with ease.
  • Automated Receipts: Generates professional PDF receipts using Puppeteer and Handlebars.
  • Email Notifications: Automatically sends email confirmations with attached PDF receipts.
  • Customizable Templates: Fully customizable HTML email and PDF receipt templates.
  • Batch Processing: Supports both sequential and parallel batch payments with advanced nonce management.
  • TypeScript First: Robust type definitions for a superior developer experience.

Installation

npm install pay_hash viem

Quick Start

import { PayHashClient } from "pay_hash";
import { createClient, http, publicActions, walletActions } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { tempoTestnet } from "viem/chains";
import { tempoActions } from "viem/tempo";

// 1. Setup Viem Client
const client = createClient({
  account: privateKeyToAccount("0x..."),
  chain: tempoTestnet,
  transport: http(),
})
  .extend(publicActions)
  .extend(walletActions)
  .extend(tempoActions());

// 2. Configure SMTP
const smtp = {
  host: "smtp.example.com",
  port: 587,
  secure: false,
  user: "your-user",
  pass: "your-password",
};

// 3. Define Email/Receipt Branding
const emailTemplate = {
  brandName: "My Brand",
  primaryColor: "#4F46E5",
  receiptTitle: "Payment Receipt",
  subject: "Success! Your Payment Receipt",
};

// 4. Initialize PayHash SDK
const payhash = new PayHashClient(client, smtp, emailTemplate);

// 5. Process Payment
const main = async () => {
  const result = await payhash.pay({
    amount: "100.50",
    token: "0x...", // Token Address
    orgAddress: "0x...", // Recipient Address
    orgName: "My Company Inc",
    orgMail: "[email protected]",
    clientMail: "[email protected]",
    memo: "Order #789",
  });

  console.log(result.success ? "Paid!" : "Error: " + result.error);
};

main();

Advanced Usage

Batch Payments

Sequential Batch (Safer)

Processes payments one by one, waiting for each to complete.

await payhash.batchPay([params1, params2]);

Parallel Batch (Faster)

Sends multiple transactions simultaneously using advanced nonce tracking.

await payhash.batchPayAsync([params1, params2]);

Customizing Templates

You can provide your own Handlebars (.hbs) files for both emails and PDF receipts.

const emailTemplate = {
  brandName: "PayHash",
  // Specify custom template paths
  pdfTemplatePath: "./templates",
  pdfTemplateName: "custom-receipt.hbs",
  emailTemplatePath: "./templates",
  emailTemplateName: "custom-email.hbs",
  // Reusable branding
  primaryColor: "#000",
  logoUrl: "https://example.com/logo.png",
};

API Reference

PayHashClient

  • constructor(client, smtp, template): Initializes the SDK.
  • pay(params): Executes a single token transfer, generates a receipt, and sends an email.
  • batchPay(params[]): Executes multiple payments sequentially.
  • batchPayAsync(params[]): Executes multiple payments in parallel using unique nonces.
  • verifyTransporter(): Checks if the SMTP configuration is valid.

Configuration Types

PayParams

| Property | Type | Description | | :----------- | :-------- | :------------------------------------------------ | | amount | string | The amount to transfer (in human-readable units). | | token | Address | The ERC20 token contract address. | | orgAddress | Address | The organization's wallet address. | | orgMail | string | The organization's support email. | | clientMail | string | The client's email address. | | memo | string | Optional payment reference. |

EmailTemplate

| Property | Type | Description | | :------------- | :------- | :------------------------------------------------ | | brandName | string | Your organization's name. | | primaryColor | string | Primary hex color for the branding. | | logoUrl | string | URL to your organization's logo. | | fontFamily | string | Font family for the PDF (Inter, Roboto, Poppins). |

License

MIT License.