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

@fanth/pay-form-sdk

v0.1.5

Published

TypeScript SDK for interacting with https://pay-form.fanth.pl

Downloads

893

Readme

@fanth/pay-form-sdk

TypeScript SDK for interacting with pay-form.fanth.pl.

Install

npm install @fanth/pay-form-sdk

With pnpm:

pnpm add @fanth/pay-form-sdk

Usage

See examples in the examples directory.

import { PayFormClient } from "@fanth/pay-form-sdk";

const client = new PayFormClient({
    apiKey: process.env.PAY_FORM_API_KEY!,
    webhookSecret: process.env.PAY_FORM_WEBHOOK_SECRET!,
    // baseUrl defaults to https://pay-form.fanth.pl
});

Generating a payment link

const url = await client.generatePaymentForm({
    title: "Order #1",
    amount: 10, // PLN, up to 2 decimal places
    paymentMethods: ["payu", "card"],
    payuPosId: 12345, // required when "card" is one of the paymentMethods
    webhookUrl: "https://example.com/api/webhooks/pay-form",
});

Handling the webhook

Once the payer picks a method, pay-form POSTs to your webhookUrl URL and waits for your response before redirecting the payer anywhere. client.parseWebhook verifies and parses that call - it checks the X-Fanth-Signature header against the raw body (and rejects stale timestamps), throwing if the signature is missing or invalid.

Your handler is where the actual payment gets initiated, and the redirectUrl you return is where the payer's browser ends up next - e.g. a hosted payment gateway page for methods that need one more step (payu, paymentic). It's optional: omit it (or return no body) and pay-form redirects the payer to its own default success page instead.

// e.g. a Next.js route handler / any Request-based HTTP framework
export async function POST(request: Request) {
    const payment = await client.parseWebhook(request);

    if (payment.method !== "card") {
        // create the order with the gateway (PayU/Paymentic) and forward the payer to its hosted payment page
        const redirectUrl = await createGatewayOrder(payment);
        return Response.json({ redirectUrl });
    }

    // already charged via payment.cardToken - no redirectUrl needed, pay-form shows its own success page
    return Response.json({});
}

Note: parseWebhook reads the body via request.text(), so pass it the raw Request before any other code consumes the body.