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

malawali-payment-gateway

v1.1.2

Published

Node.js SDK for Malawali Payment Gateway API (QRIS deposit, check, delete, mutation history)

Readme

malawali-payment-gateway

Node.js SDK resmi untuk integrasi Malawali Payment Gateway API.

Mendukung alur utama pembayaran QRIS:

  • Create payment
  • Check status payment
  • Delete/cancel payment
  • Update alias invoice
  • Ambil mutasi user
  • Helper message siap kirim ke bot Telegram/WA

Daftar Akun

Install

npm install malawali-payment-gateway

Quick Start

const pg = require("malawali-payment-gateway");

async function main() {
  const apikey = "YOUR_API_KEY";

  const create = await pg.createPayment(apikey, 10000, {
    clientRef: "ORDER-10001"
  });

  if (!create.status) {
    console.log("Create gagal:", create.code, create.message, create.http_status);
    return;
  }

  console.log("IDTRX:", create.result.idtrx);
  console.log("QR URL:", create.result.qris_url);
}

main();

Contoh Flow Deposit (Create -> Check)

const pg = require("malawali-payment-gateway");

async function sleep(ms) {
  return new Promise((resolve) => setTimeout(resolve, ms));
}

async function runDepositFlow() {
  const apikey = "YOUR_API_KEY";

  const created = await pg.createPayment(apikey, 15000, {
    clientRef: "DEP-USER123-0001"
  });

  if (!created.status) {
    console.log("Create gagal:", created.code, created.message);
    return;
  }

  const idtrx = created.result.idtrx;
  console.log("Silakan bayar:", created.result.qris_url);

  for (let i = 0; i < 30; i++) {
    const check = await pg.checkPayment(apikey, idtrx);
    const code = String(check.code || "").toUpperCase();

    if (code === "PAYMENT_PAID") {
      console.log("PAID", check);
      return;
    }

    if (code === "PAYMENT_EXPIRED") {
      console.log("EXPIRED");
      return;
    }

    if (code === "PAYMENT_CANCELLED") {
      console.log("CANCELLED");
      return;
    }

    await sleep(5000);
  }

  console.log("Timeout polling.");
}

runDepositFlow();

API SDK

  • createPayment(apikey, amount, options?)
  • checkPayment(apikey, idtrx)
  • deletePayment(apikey, idtrx, amount?)
  • updateInvoiceAlias(apikey, pw, invoice)
  • getUserMutationHistory(apikey, limit?, status?)
  • createPaymentMessage(apikey, amount, options?)
  • checkPaymentMessage(apikey, idtrx)
  • createClient({ baseUrl?, timeout? })

Struktur Response

Field umum di semua response:

  • status
  • code
  • message
  • http_status

Field tambahan penting (khusus create):

  • request_id
  • retryable

Rekomendasi Handling Kode Create

  • 201: create berhasil
  • 202: masih diproses (boleh retry)
  • 401: API key invalid
  • 409: transaksi duplikat/conflict
  • 422: parameter tidak valid
  • 429: rate limit / queue penuh
  • 503: service busy

Retry Strategy

  • Retry saat retryable === true atau http_status 429/503.
  • Gunakan exponential backoff sederhana: 2s -> 4s -> 8s.
  • Simpan clientRef unik per transaksi user.

Endpoint Default

  • Base URL default: https://restapi.heroikzre.my.id
  • Node.js minimal: >=16

Keamanan

  • Jangan expose API key di frontend publik.
  • Simpan idtrx dan request_id untuk audit/troubleshooting.

Support

  • Bot daftar: https://t.me/heroikzre_paymentgateawaybot
  • Web daftar: https://pay.heroikzre.my.id
  • Repository: https://github.com/DaffaHeroik/malawali-payment-gateway