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

@mnpay/qpay

v0.6.0

Published

Client library for the QPay payment service — invoices, payments, eBarimt 3.0 and Quick QR.

Readme

QPay API Integration

This package provides a simple interface to integrate with the QPay payment service for merchants. It allows handling payments, invoices, authentication, and more via the QPay API.

official documentation: https://developer.qpay.mn

Features

  • Authentication: Obtain and refresh access tokens.
  • Invoice Management: Create, get, and cancel invoices.
  • Payment Management: Check, get, and cancel payments, along with retrieving payment lists.

Installation

To install this package, use npm or yarn:

npm install @mnpay/qpay

or

yarn add @mnpay/qpay

Usage

Importing the Package

import { useQpay } from '@mnpay/qpay';

Example: Initializing the QPay API

const qpay = useQpay({
  baseUrl?: 'https://merchant.qpay.mn'
  version?: 'v2'
  accessToken?: 'access_token'
  refreshToken?: 'refresh_token'
  expiresIn?: new Date()
});

Methods

authenticate Obtain an access token using client_id and client_secret.

refreshToken Refresh the access token using a refresh_token.

createInvoice Create a new invoice for a payment.

getInvoice Retrieve the details of a created invoice using invoice_id.

cancelInvoice Cancel an existing invoice by sending the invoice_id.

getPayment Retrieve the details of a payment using the payment_id.

checkPayment Check if the payment was completed by providing the invoice_id and object_type.

cancelPayment Cancel a payment by sending the payment_id.

refundPayment Refund a payment by sending the payment_id, with an optional callback_url and note.

getPaymentList Retrieve a list of payments made by customers.

createEbarimt Create an eBarimt 3.0 receipt from a completed payment. Takes payment_id (from checkPayment), ebarimt_receiver_type and ebarimt_receiver.

cancelEbarimt Cancel an eBarimt receipt by payment_id, with an optional note.

Quick QR

Quick QR is a separate QPay product for registering sub-merchants and taking QR payments into their accounts. It runs on its own host (https://quickqr.qpay.mn) and its token request requires a terminal_id, so it has its own client rather than extra methods on useQpay.

import { useQpayQuickQr } from '@mnpay/qpay'

const quickQr = useQpayQuickQr({
  terminalId: process.env.QPAY_QUICKQR_TERMINAL_ID!,
  username: process.env.QPAY_CLIENT_ID!,
  password: process.env.QPAY_CLIENT_SECRET!,
})

const { data: merchant } = await quickQr.createCompanyMerchant({
  register_number: '6691374',
  company_name: 'Test LLC',
  name: 'Test',
  mcc_code: '5812',
  city: '11',
  district: '3505',
  address: 'SBD 1st khoroo',
  phone: '99112233',
  email: '[email protected]',
})

const { data: invoice } = await quickQr.createInvoice({
  merchant_id: merchant.merchant_id!,
  amount: 100,
  currency: 'MNT',
  description: 'Order payment',
  mcc_code: '5812',
  callback_url: 'https://yoursite.com/webhook/quickqr',
  bank_accounts: [
    {
      account_bank_code: '050000',
      account_number: '5016271526',
      account_name: 'Test LLC',
      is_default: true,
    },
  ],
})

const { data: payment } = await quickQr.checkPayment({ invoice_id: invoice.invoice_id! })

Tokens are obtained and refreshed automatically by an Axios interceptor. Invalid input raises QpayConfigError before any network call.

| Method | Endpoint | |---|---| | authenticate | POST /v2/auth/token | | refreshToken | POST /v2/auth/refresh | | getCityList | GET /v2/aimaghot | | getDistrictList | GET /v2/sumduureg/{city_code} | | createCompanyMerchant | POST /v2/merchant/company | | updateCompanyMerchant | PUT /v2/merchant/company/{merchant_id} | | createPersonMerchant | POST /v2/merchant/person | | updatePersonMerchant | PUT /v2/merchant/person/{merchant_id} | | getMerchant | GET /v2/merchant/{merchant_id} | | deleteMerchant | DELETE /v2/merchant/{merchant_id} | | getMerchantList | POST /v2/merchant/list | | createInvoice | POST /v2/invoice | | getInvoice | GET /v2/invoice/{invoice_id} | | cancelInvoice | DELETE /v2/invoice/{invoice_id} | | checkPayment | POST /v2/payment/check |

License

MIT License