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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pakasir-sdk

v1.0.5

Published

Pakasir SDK - Lightweight Pakasir Payment Gateway API Client Library

Readme

Pakasir Payment Gateway

SDK TypeScript ringan untuk integrasi pembayaran digital Indonesia pakasir.com. Dukung QRIS, Virtual Account multi-bank & PayPal dalam hitungan menit.

Installation · Quick Start · Configuration · Payment Methods · API Reference

📦 Installation

Install pakasir-sdk using your preferred package manager:

npm install pakasir-sdk
# or
pnpm add pakasir-sdk
# or
bun add pakasir-sdk

⚡ Quick Start

Here is a minimal example to create a payment:

import { Pakasir } from 'pakasir-sdk';

const pakasir = new Pakasir({
  slug: 'your-slug',
  apikey: 'your-api-key',
});

const result = await pakasir.createPayment('qris', 'your-order-id', 10000);

console.log(result);

🛠️ Configuration

The Pakasir constructor accepts a configuration object:

| Option | Type | Description | | :------- | :------- | :---------------------------------------------------------- | | slug | string | Required. Project slug. | | apikey | string | Required. API key. |

💰 Payment Methods

For more information about payment methods, please visit Pakasir Biaya.

| Method | Code | Fee | | -------------- | ---------------- | ---------------- | | All Methods | all | Varies | | QRIS | qris | 0.7% - 1% | | PayPal | paypal | 1% (min Rp3.000) | | BNI VA | bni_va | Rp3.500 | | BRI VA | bri_va | Rp3.500 | | CIMB Niaga VA | cimb_niaga_va | Rp3.500 | | Maybank VA | maybank_va | Rp3.500 | | Permata VA | permata_va | Rp3.500 | | BNC VA | bnc_va | Rp3.500 | | ATM Bersama VA | atm_bersama_va | Rp3.500 | | Sampoerna VA | sampoerna_va | Rp2.000 | | Artha Graha VA | artha_graha_va | Rp2.000 |

📖 API Reference

Quick Jump: Create Payment · Get Payment URL · Detail Payment · Cancel Payment · Simulation Payment · Watch Payment · Stop Watch

Create Payment

Create a new payment transaction via API.

const payment = await pakasir.createPayment('qris', 'ORDER-12345', 100_000, 'https://example.com/success');

console.log(payment);

| Parameter | Type | Description | | :------------- | :-------------- | :------------------------------------------------------- | | method | PaymentMethod | Payment method code Payment Methods | | order_id | string | Unique order ID (min 5 characters) | | amount | number | Amount in Rupiah (min Rp500) | | redirect_url | string? | Optional redirect URL after payment |


Get Payment URL

Generate payment URL without API call. Useful for client-side redirects.

const payment = pakasir.getPaymentUrl('qris', 'ORDER-12345', 100_000);

console.log(payment);

Detail Payment

Retrieve current status of a payment.

const detail = await pakasir.detailPayment('ORDER-12345', 100_000);

console.log(detail);

Cancel Payment

Cancel an existing pending payment.

const canceled = await pakasir.cancelPayment('ORDER-12345', 100_000);

console.log(canceled);

Simulation Payment

Simulate a successful payment for testing purposes.

const simulated = await pakasir.simulationPayment('ORDER-12345', 100_000);

console.log(simulated);

Watch Payment

Monitor payment status changes in real-time with polling.

pakasir.watchPayment('ORDER-12345', 100_000, {
  interval: 3000,
  timeout: 600000,

  onStatusChange: (payment) => {
    console.log('Status:', payment);
  },

  onError: (error) => console.error(error),
});

| Option | Type | Default | Description | | :--------------- | :---------------------------------- | :------- | :------------------------------- | | interval | number | 3000 | Polling interval in milliseconds | | timeout | number | 600000 | Auto-stop timeout (10 minutes) | | onStatusChange | (payment: PaymentPayload) => void | - | Callback on status change | | onError | (error: Error) => void | - | Callback on error |


Stop Watch

Manually stop watching a payment.

pakasir.stopWatch('ORDER-12345', 100_000);

PaymentPayload Type

Response type returned by all payment methods:

type PaymentPayload = {
  project: string;
  order_id: string;
  amount: number;
  fee: number;
  status: 'pending' | 'canceled' | 'completed';
  total_payment: number;
  payment_method: string;
  payment_number: string | null;
  payment_url: string | null;
  redirect_url: string | null;
  expired_at: string | Date | null;
  completed_at: string | Date | null;
};

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create new branch: git checkout -b feature/my-feature.
  3. Commit your changes: git commit -m 'Add some feature'.
  4. Push to the branch: git push origin feature/my-feature.
  5. Open Pull Request.

🎯 Issues & Feedback

If you encounter any problems or have feature requests, please open an issue

📜 License

Distributed under the MIT License. See LICENSE for details.