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

@hudoro/central-payment

v0.0.1-beta.3

Published

Backend bundling for express

Readme

Hudoro Central Payment

Hudoro Central Payment is a package that provides centralized integration for payment systems, designed to facilitate communication with multiple payment service providers from a single point.

Package instalation

Instal package using pnpm

  pnpm add @hudoro/central-payment

Instal package using yarn

  yarn add @hudoro/central-payment

Instal package using npm

  npm i @hudoro/central-payment

Configuration

To start using the Midtrans integration, you need to initialize it with your Midtrans credentials:

import { transactionConfig } from 'your-package-name';

const midtransClient = transactionConfig({
  apiURL: 'https://api.midtrans.com',  // Use 'https://api.sandbox.midtrans.com' for testing
  snapURL: 'https://app.midtrans.com', // Use 'https://app.sandbox.midtrans.com' for testing
  serverKey: 'YOUR_SERVER_KEY'
});

Usage

Create Standard Transaction

Create a standard transaction via Midtrans Snap:

const createTransaction = async () => {
  try {
    const response = await midtransClient.createTransaction({
      transaction_details: {
        order_id: "ORDER-" + new Date().getTime(),
        gross_amount: 100000
      },
      customer_details: {
        name: "John Doe",
        email: "[email protected]"
      },
      item_details: [
        {
          name: "Product Name",
          price: 100000,
          quantity: 1
        }
      ],
      callbacks: {
        finish: "https://example.com/finish",
        error: "https://example.com/error",
        pending: "https://example.com/pending"
      }
    });
    
    console.log("Transaction token:", response.data.token);
    console.log("Redirect URL:", response.data.redirect_url);
    
    return response.data;
  } catch (error) {
    console.error("Error creating transaction:", error);
  }
};

Create QRIS Transaction

Create a QRIS dynamic transaction:

const createQrisTransaction = async () => {
  try {
    const response = await midtransClient.createQrisMidtransTransaction({
      transaction_details: {
        order_id: "QRIS-" + new Date().getTime(),
        gross_amount: 50000
      },
      customer_details: {
        name: "Customer Name",
        email: "[email protected]"
      }
    });
    
    console.log("QRIS String:", response.data.qr_string);
    console.log("Expiry Time:", response.data.expiry_time);
    
    return response.data;
  } catch (error) {
    console.error("Error creating QRIS transaction:", error);
  }
};

Process Refund

Process a refund for a transaction:

const processRefund = async () => {
  try {
    const response = await midtransClient.refundTransaction({
      transactionCode: "ORDER-123456789",
      amount: 100000,
      reason: "Customer requested refund"
    });
    
    console.log("Refund Status:", response.data.status_message);
    
    return response.data;
  } catch (error) {
    console.error("Error processing refund:", error);
  }
};

Direct Refund

Process a direct online refund:

const processDirectRefund = async () => {
  try {
    const response = await midtransClient.directRefundTransaction({
      transactionCode: "ORDER-123456789",
      amount: 100000,
      reason: "Customer requested refund"
    });
    
    console.log("Direct Refund Status:", response.data.status_message);
    
    return response.data;
  } catch (error) {
    console.error("Error processing direct refund:", error);
  }
};

Cancel Transaction

Cancel a transaction:

  try {
    const response = await midtransClient.cancelTransaction("ORDER-123456789");
    
    console.log("Cancel Status:", response.data.status_message);
    
    return response.data;
  } catch (error) {
    console.error("Error cancelling transaction:", error);
  }
};

Data Types

The package includes TypeScript interfaces for all request and response objects:

ParameterTypes: Request parameters for creating transactions
MidtransResponse: Response for standard transactions
MidtransQrisDynamicResponse: Response for QRIS transactions
MidtransRefundResponse: Response for refund operations
RefundParams: Parameters for refund operations
ItemDetail: Structure for describing order items