Socket
Book a DemoInstallSign in
Socket

payoo-payment-gateway-test

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

payoo-payment-gateway-test

Payment with payoo Wallet via QR code

1.0.6
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

API Payoo Payment Gateway

The plugin will make it easier to integrate Payoo payments.

Process flow

Flow

Installation

The first, Payoo partner must be successfully registered. Use the package manager npm to install.

npm i payoo-payment-gateway

Usage

import { PayooPayment } from 'payoo-payment-gateway';


/* HOST_WEBHOOK => Partner API. Used by Payoo to submit payment results by IPN method (server-to-server) method */
const HOST_WEBHOOK = process.env.HOST_WEBHOOK;

/* constructor: username, shopId, shopTitle, checksumKey, endpointCheckout, shopDomain, endpointRefund, apiUsername, apiUserpassword, apiSignature => provided by Payoo*/
class PayooPaymentService {
    constructor(username, shopId, shopTitle, checksumKey, endpointCheckout, shopDomain, endpointRefund, apiUsername, apiUserpassword, apiSignature) {
      this.payooPayment = new PayooPayment({
        username,
        shopId,
        shopTitle,
        checksumKey,
        endpointCheckout,
        shopDomain,
        endpointRefund,
        apiUsername,
        apiUserpassword,
        apiSignature,
      })
    };

/* The payment method payUrl is returned  */
  async createPayment({
    orderId,
    orderNumber,
    amount,
    returnUrl = 'https://your-website.com',
  }) {
    try {
      const result = await this.payooPayment.createOrderRequest({
        orderId,
        orderNumber,
        amount,
        returnUrl,
        notifyUrl: HOST_WEBHOOK,
      });
      return result;
    } catch (error) {
      console.error(error)
      throw error;
    }
  }
  
/* Proceed the refund payment */
  async refundPayment({ OrderNo, PurchaseDate, Money, Description }) {
    try {
      const result = await this.payooPayment.refundPayment({
        OrderNo,
        Money,
        Description,
        PurchaseDate,
      });
      return result;
    } catch (error) {
      console.error(error)
      throw error;
    }
  }

/* The function for verify webhook request and payment */
  verifyNotifyData({ ip, xml }) {
    try {
      const result = this.payooPayment.verifyNotifyData({ ip, xml });
      return result;
    } catch (error) {
      console.error(error)
      throw error;
    }
  }

  verifyPayment({ status, session, order_no, checksum, totalAmount, paymentFee }){
    try {
      const result = this.payooPayment.verifyPayment({status, session, order_no, checksum, totalAmount, paymentFee })
      return result;
    } catch (error) {
      console.error(error)
      throw error;
    }
  }
}

Contributing

Pull requests are welcome

Important

Mail: thao.pamt@gmail.com Skype: phamanmaithao10@gmail.com Documentation: (https://github.com/pamt0504/payoo-payment-gateway/blob/master/HD%20Tich%20Hop%20Thanh%20Toan%20Payoo_Js_v2.pdf)

License

MIT

Keywords

payoo

FAQs

Package last updated on 21 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.