@mnpay/qpay
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

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://api.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.

getPaymentList Retrieve a list of payments made by customers.

License

MIT License

Package Sidebar

Install

npm i @mnpay/qpay

Weekly Downloads

0

Version

0.1.4

License

none

Unpacked Size

39.7 kB

Total Files

46

Last publish

Collaborators

  • sura0111