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

@bayarkit/paddle

v0.3.3

Published

Paddle Billing (merchant of record) for Node.js and TypeScript: create one-time transactions, verify Paddle-Signature webhooks, confirm each payment with a fresh status query, and refund. Zero dependencies, part of bayarkit.

Readme

@bayarkit/paddle

Paddle Billing (merchant of record, no MYR) for bayarkit: one interface for Malaysian and global payment gateways, and a checked way to confirm a payment. Bahasa Melayu

Evidence: Measured on the sandbox, 30 Oct 2026: card paid and declined, real signed webhooks, full and partial refunds; charges in USD or another Paddle currency, never MYR.

npm install @bayarkit/core @bayarkit/paddle
import { checkoutResponse, confirmPayment, readCallback } from '@bayarkit/core'
import { paddle } from '@bayarkit/paddle'

const gateway = paddle({ apiKey, webhookSecret, currency: 'USD' })

// Checkout: one reference per attempt; amounts are integers in the currency's smallest unit (USD 10.50 = 1050).
const payment = await gateway.createPayment({ reference, amount, description, customer, returnUrl, callbackUrl })
return checkoutResponse(payment) // a 303 redirect, or a self-submitting form when the gateway wants a POST

// Callback route: never mark an order paid from the callback body or the return URL alone.
const result = await confirmPayment(gateway, await readCallback(request), { reference, amount, currency: 'USD' })
if (result.ok) {
  // mark the order paid (idempotently: gateways retry callbacks)
}

Paddle has no per-payment return or callback URL: returnUrl and callbackUrl are not sent. Set a default payment link in Paddle > Checkout (a page of yours that loads Paddle.js) before the first payment, and add a notification destination for transaction.* events that points at your callback route. For an overlay checkout, pass payment.id to Paddle.Checkout.open({ transactionId }).

Test without real money: startFakePaddle from @bayarkit/testing answers like this gateway (signed callbacks included), and npx bayarkit-fake paddle runs it as a server for tests in other languages.

Traps

  • Paddle has no Malaysian ringgit: MYR is not a payment currency, and balances are held only in USD, EUR, GBP, AUD or CAD. Price in USD (or another listed currency) and state currency in every Expected; each currency has its own minimum (USD 0.70). (developer.paddle.com/concepts/sell/supported-currencies)
  • Paddle is the merchant of record and adds tax per buyer country. With the default tax_mode the buyer can pay more than your price, so the total is unknown before checkout. Send tax_mode: internal (price includes tax) and compare details.totals.grand_total. (developer.paddle.com create/get transaction; gateways/paddle/spec.md §2.3)
  • No transaction can be created until the account's default payment link is set (transaction_default_checkout_url_not_set). checkout.url is that link plus ?_ptxn=<transaction id>, and the page must load Paddle.js to open the checkout. (developer.paddle.com/build/transactions/default-payment-link)
  • Paddle-Signature is ts=…;h1=…: HMAC-SHA256 of ${ts}:${rawBody} with the destination's secret. More than one h1 can appear during secret rotation; the official SDKs reject a ts older than five seconds. (developer.paddle.com/webhooks/about/signature-verification; paddle-node-sdk webhooks-validator.ts)
  • A declined card does not change a one-time transaction's status: it adds an error entry to payments[] and sends transaction.payment_failed. Both paid and completed mean the payment was captured. (developer.paddle.com transaction.payment_failed, transaction.paid)
  • Refunds are adjustments on completed transactions only, and most live refunds wait in pending_approval (sandbox approves every ten minutes). The transaction stays completed after a refund; read details.adjusted_totals. There is no idempotency key: a second refund while one is pending is refused (adjustment_pending_refund_request). (developer.paddle.com/api-reference/adjustments/create-adjustment)

The full contract, with a source for every fact: gateways/paddle/spec.md.

Need help installing?

If you would rather not wire up a payment gateway yourself, Sasa Teguh, the studio that maintains bayarkit, can install it on your site or app and test it against the gateway sandbox before you go live.

Contact page · Email: [email protected] · WhatsApp: 017-762 9379

Bahasa Melayu

Paddle Billing (penjual rasmi, tiada MYR) untuk bayarkit: satu antara muka untuk gateway pembayaran Malaysia dan global, dan cara bersemak untuk mengesahkan bayaran.

Bukti: Diukur pada sandbox, 30 Okt 2026: kad dibayar dan ditolak, webhook bertandatangan sebenar, bayaran balik penuh dan separa; caj dalam USD atau mata wang Paddle lain, bukan MYR.

npm install @bayarkit/core @bayarkit/paddle

Contoh kod di atas sama untuk semua gateway: hanya adapter dan kuncinya yang berubah. Jumlah ialah integer dalam unit terkecil mata wang (USD 10.50 = 1050), dan currency dinyatakan dalam setiap semakan. Jangan tanda pesanan dibayar daripada badan callback atau pautan kembali semata-mata; confirmPayment menyemak tandatangan, bertanya gateway semula, dan memadankan rujukan, jumlah dan mata wang.

Paddle tiada URL kembali atau callback bagi setiap bayaran: returnUrl dan callbackUrl tidak dihantar. Tetapkan pautan pembayaran lalai dalam Paddle > Checkout (halaman anda sendiri yang memuatkan Paddle.js) sebelum bayaran pertama, dan tambah destinasi notifikasi untuk acara transaction.* yang menghala ke laluan callback anda. Untuk checkout overlay, hantar payment.id kepada Paddle.Checkout.open({ transactionId }).

Uji tanpa wang sebenar: startFakePaddle daripada @bayarkit/testing, atau npx bayarkit-fake paddle sebagai pelayan.

Perangkap

  • Paddle tiada ringgit Malaysia: MYR bukan mata wang pembayaran, dan baki hanya disimpan dalam USD, EUR, GBP, AUD atau CAD. Letak harga dalam USD (atau mata wang lain yang disenaraikan) dan nyatakan currency dalam setiap Expected; setiap mata wang ada minimum sendiri (USD 0.70). (developer.paddle.com/concepts/sell/supported-currencies)
  • Paddle ialah penjual rasmi (merchant of record) dan menambah cukai ikut negara pembeli. Dengan tax_mode lalai, pembeli boleh membayar lebih daripada harga anda, jadi jumlahnya tidak diketahui sebelum checkout. Hantar tax_mode: internal (harga termasuk cukai) dan bandingkan details.totals.grand_total. (developer.paddle.com create/get transaction; gateways/paddle/spec.md §2.3)
  • Tiada transaksi boleh dicipta selagi pautan pembayaran lalai akaun belum ditetapkan (transaction_default_checkout_url_not_set). checkout.url ialah pautan itu ditambah ?_ptxn=<id transaksi>, dan halaman itu mesti memuatkan Paddle.js untuk membuka checkout. (developer.paddle.com/build/transactions/default-payment-link)
  • Paddle-Signature berbentuk ts=…;h1=…: HMAC-SHA256 bagi ${ts}:${rawBody} dengan rahsia destinasi itu. Lebih daripada satu h1 boleh muncul semasa putaran rahsia; SDK rasmi menolak ts yang lebih lama daripada lima saat. (developer.paddle.com/webhooks/about/signature-verification; paddle-node-sdk webhooks-validator.ts)
  • Kad yang ditolak tidak mengubah status transaksi sekali bayar: ia menambah entri error dalam payments[] dan menghantar transaction.payment_failed. paid dan completed kedua-duanya bermaksud bayaran sudah ditangkap. (developer.paddle.com transaction.payment_failed, transaction.paid)
  • Bayaran balik ialah adjustment pada transaksi completed sahaja, dan kebanyakan bayaran balik live menunggu dalam pending_approval (sandbox meluluskan setiap sepuluh minit). Transaksi kekal completed selepas bayaran balik; baca details.adjusted_totals. Tiada kunci idempotensi: bayaran balik kedua semasa satu masih menunggu ditolak (adjustment_pending_refund_request). (developer.paddle.com/api-reference/adjustments/create-adjustment)

Kontrak penuh, dengan sumber bagi setiap fakta: gateways/paddle/spec.md. Dokumentasi penuh: README.ms.md.

Perlukan bantuan memasang?

Jika anda tidak mahu menyambung gateway pembayaran sendiri, Sasa Teguh, studio yang menyelenggara bayarkit, boleh memasangnya di laman atau aplikasi anda dan mengujinya pada sandbox gateway sebelum anda mula menerima bayaran.

Halaman hubungi · E-mel: [email protected] · WhatsApp: 017-762 9379

MIT © Muhammad Aiman