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

@mongolian-payment/monpay

v1.0.0

Published

MonPay payment SDK for Node.js - QR payments and deeplink invoices

Downloads

75

Readme

@mongolian-payment/monpay

TypeScript SDK for MonPay payment integration. Supports both QR code payments and deeplink invoices with zero dependencies.

Installation

npm install @mongolian-payment/monpay

Requires Node.js >= 18.0.0 (uses native fetch and btoa).

QR Payments

Use MonPayQrClient for QR-based payments with HTTP Basic Auth.

import { MonPayQrClient } from "@mongolian-payment/monpay";

const client = new MonPayQrClient({
  endpoint: "https://api.monpay.mn",
  username: "your-username",
  accountId: "your-account-id",
  callbackUrl: "https://yoursite.com/monpay/callback",
});

// Generate a QR code
const qr = await client.generateQr(5000);
console.log(qr.result.qrcode); // base64 QR image
console.log(qr.result.uuid); // UUID for tracking

// Check payment status
const status = await client.checkQr(qr.result.uuid);
console.log(status.result.transactionId);

// Parse callback
const callback = client.parseCallback(new URL(callbackUrl));
console.log(callback.amount, callback.status);

Deeplink Invoices

Use MonPayDeeplinkClient for deeplink-based payments with OAuth2.

import { MonPayDeeplinkClient } from "@mongolian-payment/monpay";

const client = new MonPayDeeplinkClient({
  endpoint: "https://api.monpay.mn",
  clientId: "your-client-id",
  clientSecret: "your-client-secret",
  grantType: "client_credentials",
  webhookUrl: "https://yoursite.com/monpay/webhook",
  redirectUrl: "https://yoursite.com/monpay/redirect",
});

// Create a deeplink invoice (auto-authenticates)
const invoice = await client.createDeeplink(
  10000,      // amount
  "P2B",      // invoiceType
  "branch1",  // branchUsername (receiver)
  "Order #42" // description
);
console.log(invoice.result.id);

// Check invoice status
const status = await client.checkInvoice(invoice.result.id);
console.log(status.result.status, status.result.bankName);

// Parse callback
const callback = client.parseCallback(new URL(webhookUrl));
console.log(callback.invoiceId, callback.status);

Types

All request/response types are exported:

import type {
  InvoiceType,
  Bank,
  MonPayQrConfig,
  MonPayDeeplinkConfig,
  MonPayQrResponse,
  MonPayCheckResponse,
  MonPayCallback,
  DeeplinkCreateResponse,
  DeeplinkCheckResponse,
  DeeplinkCallback,
} from "@mongolian-payment/monpay";

Error Handling

All API errors throw MonPayError with HTTP status code and response body:

import { MonPayError } from "@mongolian-payment/monpay";

try {
  await client.generateQr(5000);
} catch (err) {
  if (err instanceof MonPayError) {
    console.error(err.message);    // Human-readable message
    console.error(err.statusCode); // HTTP status code
    console.error(err.response);   // Raw response body
  }
}

License

MIT