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

dra-qris-api

v1.0.1-dra.6

Published

Connector and modules for QRIS API DenayRestAPI

Readme

DRA QRIS API

QRIS Dinamis Generator + Auto Payment Handler

Library Node.js untuk membuat QRIS, membaca bukti transfer secara otomatis, dan memverifikasi pembayaran melalui API.



⚡ Fitur Utama

  • ⚡ Generate QRIS dinamis otomatis
  • 🔍 Membaca foto bukti transfer otomatis
  • 🤖 Auto Payment Handler untuk bot WhatsApp (untuk saat ini hanya pada bot WhatsApp)
  • 🔐 HMAC Signature SHA-256 untuk keamanan request
  • 🗂️ Sangat mudah diintegrasikan ke bot / server mana pun

🛠️ Instalasi

npm i dra-qris-api

📁 Struktur Fungsi

Library ini menyediakan 4 fitur utama:

🧠 Arsitektur Singkat

flowchart TD
  A["User Kirim Command Order"] --> B["createQris()"]
  B --> C["Generate QRIS + ID"]
  C --> D["Simpan ke globalPending"]
  D --> E["User Kirim Bukti Transfer"]
  E --> F["handlePaymentProof()"]
  F --> G["OCR Tesseract"]
  G --> H["submitProof()"]
  H --> I{"Status Paid?"}
  I -->|YES| J["Success Callback (bot handle)"]
  I -->|NO| K["Reply: Pembayaran belum valid"]

🚀 Cara Penggunaan

1. Import Function

const {
  createQris,
  submitProof,
  handlePaymentProof,
  globalPending,
} = require("dra-qris-api");

2. Generate QRIS

const { id, buffer } = await createQris({
  nominal: 15000,
  merchantName: "NAMA MERCHANT",
  qris: "STRING_QRIS",
  apikey: "API_KEY", // Hubungi admin atau kunjungi https://api.denayrestapi.xyz untuk mendapatkan apikey
});

Simpan transaksi:

globalPending[userId] = {
  id,
  nominal: 15000,
  merchantName: "NAMA MERCHANT",
  description: "Pembelian Paket Premium",
  meta: { type: "premium" },
};

3. Handler Bukti Transfer

if (m.message?.imageMessage) {
  const result = await handlePaymentProof({
    m,
    NekonoidF,
    reply,
    botname: "MyBot",
    apiKey: "API_KEY_KAMU", // Hubungi admin atau kunjungi https://api.denayrestapi.xyz untuk mendapatkan apikey
  });

  if (!result) return; // gambar biasa bukan bukti tf

  if (result.status === "paid") {
    await reply("🎉 Pembayaran berhasil diterima!");
  }
}

4. Struktur Return dari handlePaymentProof()

{
  status: "paid",
  ocrAmount: 15000,
  ocrText: "...hasil bukti transfer...",
  pending: {
    id: "...",
    nominal: 15000,
    merchantName: "NAMA MERCHANT",
    description: "Pembelian Paket Premium",
    meta: {...},
  },
  apiResult: {...}
}

📦 Fitur: globalPending

Contoh penyimpanan transaksi:

globalPending["[email protected]"] = {
  id: "PAY123",
  nominal: 20000,
  description: "Topup Saldo",
  meta: {
    type: "topup",
    amount: 20000,
  },
};

Menghapus transaksi:

delete globalPending[m.sender];

Implementasi Lengkap

if (m.message?.imageMessage) {
  const result = await handlePaymentProof({
    m,
    NekonoidF: conn,
    reply: (txt) => conn.sendMessage(m.chat, { text: txt }),
    botname: "BotDigital",
    apiKey: "API_KEY", // Hubungi admin atau kunjungi https://api.denayrestapi.xyz untuk mendapatkan apikey
  });

  if (result?.status === "paid") {
    if (result.pending.meta.product === "A") {
      // kasih produk
    }
  }
}

switch (command) {
  case "buy":
    {
      const basePrice = 20000;

      // Kode unik untuk mencegah gambar palsu
      const uniqueCode = Math.floor(Math.random() * 100); // 0 - 99
      const nominal = basePrice + uniqueCode;

      const { id, buffer } = await createQris({
        nominal,
        merchantName: "TOKO SAYA",
        qris: "QRIS STRING",
        apikey: "API_KEY", // Hubungi admin atau kunjungi https://api.denayrestapi.xyz untuk mendapatkan apikey
      });

      globalPending[m.sender] = {
        id,
        nominal,
        description: "Pembelian Produk A",
        meta: { product: "A", uniqueCode },
      };

      await conn.sendMessage(m.chat, {
        image: Buffer.from(buffer),
        caption: `💳 *Pembayaran Produk A*\nNominal: Rp${nominal}\n\nSilakan scan QRIS dan unggah bukti transfer.`,
      });
    }
    break;
}

🛡️ Keamanan

  • Semua request memakai HMAC-SHA256 signature
  • Timestamp + request-id otomatis

NOTE

Ini hanya menggunakan metode validasi pembayaran via bukti transfer, tidak melakukan pembayaran otomatis layaknya API QRIS langsung. Silahkan gunakan API QRIS langsung jika cara ini terbilang rumit, cara ini hanya sebagai alternatif.

👨‍💻 Sosial Media Kreator