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

pakasir-client

v1.0.0

Published

Official Pakasir payment gateway client for Node.js and TypeScript

Readme

Pakasir Client

Official Node.js/TypeScript client for Pakasir payment gateway. Easy integration for websites and web applications with QRIS and payment URL support.

npm version License: MIT

Features

  • 🚀 Easy Integration - Simple API for websites and web applications
  • 💳 Multiple Payment Methods - QRIS, Virtual Account, and more
  • 🔗 Payment URLs - Generate redirect URLs for customers
  • 📱 QRIS Support - Generate QR codes for mobile payments
  • 🌐 QR + URL - QR code + Payment URL in one call
  • 🔍 Transaction Status - Check payment status in real-time
  • 🧪 Sandbox Mode - Test payments with simulation
  • 📦 TypeScript Support - Full type definitions included
  • 🛡️ Webhook Validation - Secure webhook handling

Installation

npm install pakasir-client

Quick Start

1. Initialize Client

import { PakasirClient } from 'pakasir-client';

const pakasir = new PakasirClient({
  project: 'your-project-slug',
  apiKey: 'your-api-key'
});

2. Create Payment (QR + URL)

// Create payment with both QR code and URL
const payment = await pakasir.createPaymentWithQRAndURL('ORDER123', 50000, {
  qrOptions: { size: 300 },
  urlOptions: { redirect: 'https://yoursite.com/success' }
});

console.log('QR Code:', payment.dataUrl);
console.log('Payment URL:', payment.paymentUrl);
console.log('Payment Number:', payment.paymentNumber);
console.log('Expires at:', payment.expiredAt);

3. Alternative: QR Only

// Create QRIS payment only
const qris = await pakasir.createQRIS('ORDER123', 50000);
console.log('QR Code:', qris.dataUrl);

4. Alternative: URL Only

// Generate payment URL only
const paymentUrl = pakasir.generatePaymentUrl({
  orderId: 'ORDER123',
  amount: 50000,
  redirect: 'https://yoursite.com/success'
});
console.log('Payment URL:', paymentUrl);

Usage Examples

Website Integration

import { PakasirClient } from 'pakasir-client';

const pakasir = new PakasirClient({
  project: 'my-website',
  apiKey: 'pk_live_...'
});

// Create payment with QR + URL
app.post('/create-payment', async (req, res) => {
  try {
    const { amount } = req.body;
    const orderId = `WEB_${Date.now()}`;
    
    // Create payment with both QR code and URL
    const payment = await pakasir.createPaymentWithQRAndURL(orderId, amount, {
      qrOptions: { size: 300 },
      urlOptions: { redirect: 'https://yoursite.com/success' }
    });
    
    res.json({
      success: true,
      qrCode: payment.dataUrl,
      paymentUrl: payment.paymentUrl,
      paymentNumber: payment.paymentNumber,
      expiredAt: payment.expiredAt
    });
  } catch (error) {
    res.status(400).json({ error: error.message });
  }
});

// Check payment status
app.get('/payment-status/:orderId', async (req, res) => {
  try {
    const { orderId } = req.params;
    const { amount } = req.query;
    
    const status = await pakasir.checkTransactionStatus(orderId, parseInt(amount));
    res.json(status);
  } catch (error) {
    res.status(400).json({ error: error.message });
  }
});

Webhook Handling

import express from 'express';
import { PakasirClient, WebhookPayload } from 'pakasir-client';

const app = express();
const pakasir = new PakasirClient({
  project: 'my-project',
  apiKey: 'pk_live_...'
});

app.use(express.json());

// Webhook endpoint
app.post('/webhook/pakasir', (req, res) => {
  const payload: WebhookPayload = req.body;
  
  // Validate webhook
  if (!pakasir.validateWebhook(payload)) {
    return res.status(400).json({ error: 'Invalid webhook payload' });
  }
  
  // Handle successful payment
  if (payload.status === 'completed') {
    console.log(`Payment completed for order ${payload.order_id}`);
    console.log(`Amount: Rp ${payload.amount.toLocaleString()}`);
    console.log(`Method: ${payload.payment_method}`);
    console.log(`Completed at: ${payload.completed_at}`);
    
    // Update your database, send notifications, etc.
    handleSuccessfulPayment(payload);
  }
  
  res.json({ received: true });
});

async function handleSuccessfulPayment(payload: WebhookPayload) {
  // Your business logic here
  // - Update order status in database
  // - Send confirmation email
  // - Update inventory
  // - etc.
}

API Reference

PakasirClient

Constructor

new PakasirClient(config: PakasirConfig)

Config Options:

  • project (string): Your project slug from Pakasir dashboard
  • apiKey (string): Your API key from Pakasir dashboard
  • baseUrl (string, optional): Base URL for API (default: https://app.pakasir.com)
  • timeout (number, optional): Request timeout in ms (default: 30000)

Methods

createPaymentWithQRAndURL(orderId, amount, options?) - NEW!

Create payment with both QR code and URL.

const payment = await pakasir.createPaymentWithQRAndURL('ORDER123', 50000, {
  qrOptions: { size: 300 },
  urlOptions: { redirect: 'https://yoursite.com/success' }
});
createTransaction(method, orderId, amount)

Create a new payment transaction.

const transaction = await pakasir.createTransaction('qris', 'ORDER123', 50000);
createQRIS(orderId, amount, options?)

Create QRIS payment with QR code generation.

const qris = await pakasir.createQRIS('ORDER123', 50000, {
  size: 300,
  format: 'png'
});
generatePaymentUrl(options)

Generate payment URL for customer redirect.

const url = pakasir.generatePaymentUrl({
  orderId: 'ORDER123',
  amount: 50000,
  redirect: 'https://yoursite.com/success',
  qrisOnly: true
});
checkTransactionStatus(orderId, amount)

Check transaction status.

const status = await pakasir.checkTransactionStatus('ORDER123', 50000);
simulatePayment(orderId, amount)

Simulate payment (sandbox mode only).

const result = await pakasir.simulatePayment('ORDER123', 50000);

Payment Methods

Supported payment methods:

  • qris - QRIS (QR Code)
  • bni_va - BNI Virtual Account
  • bri_va - BRI Virtual Account
  • cimb_niaga_va - CIMB Niaga Virtual Account
  • permata_va - Permata Virtual Account
  • maybank_va - Maybank Virtual Account
  • sampoerna_va - Sampoerna Virtual Account
  • bnc_va - BNC Virtual Account
  • artha_graha_va - Artha Graha Virtual Account
  • atm_bersama_va - ATM Bersama Virtual Account
  • retail - Retail Payment

Error Handling

import { PakasirError } from 'pakasir-client';

try {
  const qris = await pakasir.createQRIS('ORDER123', 50000);
} catch (error) {
  if (error instanceof PakasirError) {
    console.error('Pakasir Error:', error.message);
    console.error('Status Code:', error.statusCode);
    console.error('Response:', error.response);
  } else {
    console.error('Unexpected error:', error);
  }
}

TypeScript Support

Full TypeScript definitions are included:

import { 
  PakasirClient, 
  PakasirConfig, 
  CreateTransactionResponse,
  QRISResult,
  WebhookPayload 
} from 'pakasir-client';

Contributing

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

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Changelog

v1.0.0

  • Initial release
  • QRIS payment support
  • Payment URL generation
  • QR + URL integration
  • Transaction status checking
  • Webhook validation
  • TypeScript support
  • Website integration examples