Skip to content

Latest commit

 

History

History
107 lines (76 loc) · 3.08 KB

README_en-US.md

File metadata and controls

107 lines (76 loc) · 3.08 KB

vnpayjs

VI | EN

NPM Version Package License NPM Downloads

An open-source library support to payment with VNPay.

Documentations

Documentation of the library: vnpay.js.org

VNPay documentation: sandbox.vnpayment.vn/apis

Installation

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

Usage

Initialize

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
});

Support

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

Buy me a coffee Momo donation

Contribution

Getting Started

Before contributing, please read our Contribution Guidelines.

Contributors

List of Contributors

License

MIT © Lê Huy Giang