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

@zagi_14/nuxt-przelewy24

v0.1.0

Published

Nuxt 4 module for Przelewy24 (P24) payments — wraps @zagi_14/przelewy24-ts-sdk with server routes, runtime config, and auto-imported composables.

Readme

@zagi_14/nuxt-przelewy24

npm version ci License Nuxt

Nuxt 4 module for Przelewy24 (P24) payments. Wraps @zagi_14/przelewy24-ts-sdk with runtime config, a server-only useP24() composable, and an automatic webhook handler.

Install

pnpm add @zagi_14/nuxt-przelewy24 @zagi_14/przelewy24-ts-sdk

Add to nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['@zagi_14/nuxt-przelewy24'],
  p24: {
    merchantId: Number(process.env.P24_MERCHANT_ID),
    apiKey: process.env.P24_API_KEY!,
    crcKey: process.env.P24_CRC_KEY!,
    environment: 'sandbox', // or 'production'
  },
})

All options also accept runtimeConfig.p24.* overrides, so you can keep secrets out of source and inject them via NUXT_P24_API_KEY, NUXT_P24_CRC_KEY, etc.

Options

| Option | Type | Default | Description | | ------------- | ----------------------------- | ---------------------- | ---------------------------------------------------- | | merchantId | number | 0 | P24 merchant id. | | posId | number | merchantId | POS id (defaults to merchant id). | | apiKey | string | '' | API key (HTTP Basic auth password). | | crcKey | string | '' | CRC key used to sign requests and verify webhooks. | | environment | 'sandbox' | 'production' | 'sandbox' | Switches base URL. | | webhookPath | string | '/api/p24/webhook' | Path the module registers as the notification URL. |

Usage — useP24()

useP24() is auto-imported in your Nitro server code and returns a memoized P24Client.

// server/api/checkout.post.ts
export default defineEventHandler(async (event) => {
  const body = await readBody<{ amount: number, email: string }>(event)
  const p24 = useP24()
  const origin = getRequestURL(event).origin

  const { redirectUrl } = await p24.registerTransaction({
    sessionId: crypto.randomUUID(),
    amount: body.amount,
    currency: 'PLN',
    description: 'Order #42',
    email: body.email,
    urlReturn: `${origin}/return`,
    urlStatus: `${origin}/api/p24/webhook`, // matches `webhookPath`
  })

  return { redirectUrl }
})

Verifying the final status and triggering a refund:

// server/api/return.get.ts
export default defineEventHandler(async (event) => {
  const { sessionId, amount, orderId } = getQuery(event)
  const p24 = useP24()
  await p24.verifyTransaction({
    sessionId: String(sessionId),
    amount: Number(amount),
    currency: 'PLN',
    orderId: Number(orderId),
  })
  return { ok: true }
})
const p24 = useP24()
await p24.refund({
  requestId: crypto.randomUUID(),
  refundsUuid: crypto.randomUUID(),
  refunds: [{
    orderId: 12345,
    sessionId: 'order-1',
    amount: 1099,
    description: 'Customer requested refund',
  }],
})

The composable is server-only. Never import it in a Vue component — it would leak your apiKey and crcKey into the client bundle.

Webhook handler

The module registers a POST handler at webhookPath (default /api/p24/webhook) that:

  1. Reads the JSON body.
  2. Calls verifyWebhook from @zagi_14/przelewy24-ts-sdk/webhooks to validate the SHA-384 signature.
  3. Returns { received: true } on success, 400 on signature mismatch.

To run your own logic after verification, attach a callback in a Nitro plugin:

// server/plugins/p24.ts
import type { WebhookPayload } from '@zagi_14/przelewy24-ts-sdk'

export default defineNitroPlugin((nitro) => {
  nitro.hooks.hook('request', (event) => {
    event.context.$p24 = {
      onNotification: async (payload: WebhookPayload) => {
        // Mark the order paid, send a receipt, kick off fulfilment...
        const p24 = useP24()
        await p24.verifyTransaction({
          sessionId: payload.sessionId,
          amount: payload.amount,
          currency: payload.currency,
          orderId: payload.orderId,
        })
      },
    }
  })
})

If you need full control, set webhookPath to a path you implement yourself and skip the built-in handler.

Related

For the full client API (registerTransaction, verifyTransaction, refund, testAccess, verifyWebhook, error classes, types), see @zagi_14/przelewy24-ts-sdk.

Contributing

pnpm install
pnpm dev:prepare
pnpm dev          # run playground
pnpm test
pnpm build

License

MIT © 2026 Michał Zagalski