An open-source library support to payment with VNPay.
Documentation of the library: vnpay.js.org
VNPay documentation: sandbox.vnpayment.vn/apis
Tip
If you are using Nestjs
you should install nestjs-vnpay
along with this library.
Install vnpay
with npm
:
$ npm install vnpay
Install vnpay
with yarn
:
$ yarn add vnpay
Install vnpay
with pnpm
:
$ pnpm install vnpay
import { VNPay, ignoreLogger } from 'vnpay';
const vnpay = new VNPay({
tmnCode: '2QXUI4B4',
secureSecret: 'secret',
vnpayHost: 'https://sandbox.vnpayment.vn',
testMode: true, // optional
hashAlgorithm: 'SHA512', // optional
/**
* On/off logger
* If enableLog is false, loggerFn will not be used in any method
*/
enableLog: true, // optional
/**
* `loggerFn` will be called to write log when enableLog is true
* By default, loggerFn will write log to console
* If you want to write log to other place, you can provide other function here
*
* `ignoreLogger` is a function do nothing
*
*/
loggerFn: ignoreLogger, // optional
});
VNPay
is an open-source and free project. If you find it useful, please consider supporting it by starring ⭐️ the repository on Github and buying me a coffee
Before contributing, please read our Contribution Guidelines.