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/bayarcash

v0.3.3

Published

Bayarcash for Node.js and TypeScript: create payments, verify callbacks and confirm each payment with a fresh status query. Zero dependencies, part of bayarkit.

Downloads

764

Readme

@bayarkit/bayarcash

Bayarcash (also behind BCL.my) for bayarkit: one interface for Malaysian payment gateways, and a checked way to confirm a payment. Bahasa Melayu

Evidence: Measured on the sandbox, 27 Oct 2026: a paid and a failed FPX payment through the adapter (return URL, status query, portal); the server-to-server callback was not observed.

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

const gateway = bayarcash({ token, secretKey, portalKey, environment: 'sandbox' })

// Checkout: one reference per attempt; amounts are integer sen (RM10.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 })
if (result.ok) {
  // mark the order paid (idempotently: gateways retry callbacks)
}

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

Traps

  • The API secret key is account-wide: a correctly signed return or callback can belong to another portal in the same account. A transaction names its portal by NAME (portal), so give every portal a unique name; the adapter compares it with the configured portal key's name. (gateways/bayarcash/spec.md (measured))
  • The checkout id is a payment intent (pi_…), not a transaction: GET /transactions/pi_… is 404. Read it with GET /payment-intents/{id} (status and attempts), which answers 201 even though it is a read. (gateways/bayarcash/spec.md (measured))
  • The checksum sorts values by field NAME and joins them with |; a payment_channel list is joined with , inside it. (official PHP SDK ChecksumGenerator + tests)
  • amount is ringgit with two decimals ("25.00") in both the JSON body and the checksum; a callback may carry it as a number. (official PHP SDK tests)
  • order_number (the reference) takes at most 30 characters of ASCII letters, digits, space and "()*,-./:;@\_`~, with no leading or trailing space: a UUID (36) or #, &, ?, + or a non-ASCII letter is refused with 422. None of this is in the API reference; the adapter refuses such a reference before the request (INVALID_REFERENCE). (gateways/bayarcash/spec.md (measured))
  • The Personal Access Token is long (984 characters on the sandbox): keep it in a TEXT column or a secret store, not VARCHAR(255); a token cut to 255 characters answers 401 Unauthenticated. (gateways/bayarcash/spec.md (measured))
  • GET /portals is paginated (15 per page, newest first). An integration that reads only the first page loses its portal once the account has more; the adapter asks by portal_key and walks every page. (gateways/bayarcash/spec.md (measured))

The full contract, with a source for every fact: gateways/bayarcash/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

Bayarcash (juga di belakang BCL.my) untuk bayarkit: satu antara muka untuk gateway pembayaran Malaysia, dan cara bersemak untuk mengesahkan bayaran.

Bukti: Diukur pada sandbox, 27 Okt 2026: satu bayaran FPX berjaya dan satu gagal melalui adapter (URL return, pertanyaan status, portal); callback pelayan-ke-pelayan tidak diperhatikan.

npm install @bayarkit/core @bayarkit/bayarcash

Contoh kod di atas sama untuk semua gateway: hanya adapter dan kuncinya yang berubah. Jumlah ialah sen integer (RM10.50 = 1050). 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.

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

Perangkap

  • Kunci rahsia API meliputi seluruh akaun: return atau callback yang ditandatangani dengan betul boleh milik portal lain dalam akaun yang sama. Transaksi menamakan portalnya ikut NAMA (portal), jadi beri setiap portal nama yang unik; adapter membandingkannya dengan nama bagi kunci portal yang dikonfigurasi. (gateways/bayarcash/spec.md (measured))
  • Id checkout ialah payment intent (pi_…), bukan transaksi: GET /transactions/pi_… memberi 404. Baca dengan GET /payment-intents/{id} (status dan percubaan), yang menjawab 201 walaupun ia bacaan. (gateways/bayarcash/spec.md (measured))
  • Checksum mengisih nilai mengikut NAMA medan dan menyambungnya dengan |; senarai payment_channel disambung dengan , di dalamnya. (official PHP SDK ChecksumGenerator + tests)
  • amount ialah ringgit dengan dua tempat perpuluhan ("25.00") dalam badan JSON dan dalam checksum; callback mungkin membawanya sebagai nombor. (official PHP SDK tests)
  • order_number (rujukan) menerima paling banyak 30 aksara huruf ASCII, digit, ruang dan "()*,-./:;@\_`~, tanpa ruang di awal atau hujung: UUID (36), atau #, &, ?, + atau huruf bukan ASCII ditolak dengan 422. Semua ini tiada dalam rujukan API; adapter menolak rujukan begitu sebelum permintaan (INVALID_REFERENCE). (gateways/bayarcash/spec.md (measured))
  • Personal Access Token panjang (984 aksara pada sandbox): simpan dalam lajur TEXT atau stor rahsia, bukan VARCHAR(255); token yang dipotong ke 255 aksara menjawab 401 Unauthenticated. (gateways/bayarcash/spec.md (measured))
  • GET /portals dibahagi kepada halaman (15 sehalaman, terbaru dahulu). Integrasi yang membaca halaman pertama sahaja kehilangan portalnya bila akaun ada lebih banyak; adapter bertanya ikut portal_key dan melalui setiap halaman. (gateways/bayarcash/spec.md (measured))

Kontrak penuh, dengan sumber bagi setiap fakta: gateways/bayarcash/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