1.0.1 • Published 2 years ago

neopay-react-pg v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

neopay-react-pg

ReactJS SDK for NeoPay Payment Gateway

Install

npm install neopay-react-pg --save

Use

import React from 'react';
import NeoPayPaymentGateway from "neopay-react-pg";

const CheckoutComponent = () => {
    const checkoutWithNeoPay = () => {
        NeoPayPaymentGateway.pay({
            neo_MerchantCode: 'concung',
            neo_PaymentMethod: ["WALLET", "ATM", "CC"],
            neo_Currency: 'VND',
            neo_Locale: 'vi',
            neo_Version: '1',
            neo_Command: 'PAY',
            neo_Amount: 100000,
            neo_MerchantTxnID: 'T23343243',
            neo_OrderID: 'DH23343243',
            neo_OrderInfo: `Thanh toán ĐH DH23343243`,
            neo_Title: 'Thanh toán',
            neo_ReturnURL: "https://merchant-domain.com/cart/23343243/checkout",
            neo_AgainURL: "https://merchant-domain.com/cart/23343243/checkout"
        }, '123456');
    }

    return (
        <div>
            <input type="button" value="Checkout with NeoPay" onClick={e => checkoutWithNeoPay()}/>
    </div>
);
};

export default CheckoutComponent;

Methods

pay

NeoPayPaymentGateway.pay

ParamTypeDefaultDescription
neo_MerchantCodestringneo_MerchantCode
neo_PaymentMethodboolean"WALLET", "ATM", "CC"neo_PaymentMethod
neo_CurrencystringVNDneo_Currency
neo_Localestringvineo_Locale
neo_Versionstring1neo_Version
neo_CommandstringPAYneo_Command
neo_AmountnumberAmount
neo_MerchantTxnIDstringneo_MerchantTxnID
neo_OrderIDstringneo_OrderID
neo_OrderInfostringneo_OrderInfo
neo_Titlestringneo_Title
neo_ReturnURLstringneo_ReturnURL
neo_AgainURLstringneo_AgainURLFires changeDetectorRef.detectChanges() when activated. Helps show toast from asynchronous events outside of Angular's change detection