0.0.11 • Published 5 years ago
newebpay v0.0.11
NewebPay Implementation
- Referencing NewebPay API Document to perform API calling and bundle it into a module
How to install
npm install newebpayHow to use
- Declare for the module globally
const { TradeModules } = require('newebpay');Before version 0.0.11
- Initialize module
const trade = new TradeModules(
 'your domain information <string>',
 'your newebpay MerchantID <string>',
 'your newebpay HashKey <string>',
 'your newebpay HashIV <string>',
 'newebpay PayGateWay <string>',
 'your newebpay ClientBackURL <string>'
);After version 0.0.11
- Initialize module
const trade = new TradeModules();CallIng API
Before version 0.0.11
- When you want to return tradeInfo then calling Newebpay Authorization
const tradeInfo = trade.getTradeInfo(
  Amt: number,
  DESC: string,
  email: string
);- Expecting tradeInfooutput example
{
  "MerchantID": "your newebpay MerchantID <string>",
  "TradeInfo": "aes256 encryption",
  "TradeSha": "sha256 hashing",
  "Version": "1.5",
  "PayGateWay": "https://ccore.spgateway.com/MPG/mpg_gateway",
  "MerchantOrderNo": "1581686501236"
}- When you want Decrypt Newebpay Feedback Information
const tradeData = JSON.parse(trade.createMpgAesDecrypt(TradeInfo));After version 0.0.11
- Set the trade config
const trade = await tradeModules.setTrade({
  URL: 'your domain information <string>',
  MerchantID: 'your newebpay MerchantID <string>',
  HashKey: 'your newebpay HashKey <string>',
  HashIV: 'your newebpay HashIV <string>',
  PayGateWay: 'newebpay PayGateWay <string>',
  ClientBackURL: 'your newebpay ClientBackURL <string>',
});- When you want to return tradeInfo then calling Newebpay Authorization
const tradeInfo = trade.getTradeInfo(
  Amt: number,
  DESC: string,
  email: string
);- Expecting tradeInfooutput example
{
  "MerchantID": "your newebpay MerchantID <string>",
  "TradeInfo": "aes256 encryption",
  "TradeSha": "sha256 hashing",
  "Version": "1.5",
  "PayGateWay": "https://ccore.spgateway.com/MPG/mpg_gateway",
  "MerchantOrderNo": "1581686501236"
}- When you want Decrypt Newebpay Feedback Information
const tradeData = trade.createMpgAesDecrypt(TradeInfo);- Expecting tradeDataoutput example
{
  "MerchantID": "test1test1",
  "RespondType": "JSON",
  "TimeStamp": "1581755183872",
  "Version": "1.5",
  "MerchantOrderNo": "1581755183872",
  "LoginType": "0",
  "OrderComment": "OrderComment",
  "Amt": "3700",
  "ItemDesc": "1",
  "Email": "test1@example.com",
  "ReturnURL": "http://localhost:3000/ReturnURL",
  "NotifyURL": "http://localhost:3000/NotifyURL",
  "ClientBackURL": "http://localhost:3000/ClientBackURL"
}ChangeLog
CopyRight
Copyright © 2020, 11. Released under the MIT License.