Skip to content
/ gmopg Public
forked from pepabo/gmopg

💳 Simple Nodejs wrapper for GMO Payment Gateway API.

License

Notifications You must be signed in to change notification settings

cynack/gmopg

 
 

Repository files navigation

GMO Payment Gateway API Client: Unofficial

Simple Nodejs wrapper for GMO Payment Gateway API.

This library is based on pepabo/gmopg. Plase star original repository.

Installation

npm install @cynack/gmopg

Usage

Purchase example below

Node.js

const {default: GMOPG, ENUMS} = require('gmopg');

const gmopg = new GMOPG({
  baseUrl: 'https://p01.mul-pay.jp',
  SiteID: 'Your SiteID',
  SitePass: 'Your SitePass',
  ShopID: 'Your ShopID',
  ShopPass: 'Your SitePass',
})

const orderID = 'Order ID'
const amount  = 1234

gmopg.entryTran({
  OrderID: orderID,
  JobCd: ENUMS.JobCd.Auth,
  Amount: amount
}).then((entryRes) => {
  gmopg.execTran({
    AccessID: entryRes.AccessID,
    AccessPass: entryRes.AccessPass,
    OrderID: orderID,
    Method: ENUMS.Method.Lump,
    CardNo: '1234123412341234',
    Expire: '2024',
    SecurityCode: '123'
  }).then((execRes) => {
    gmopg.alterTran({
      AccessID: entryRes.AccessID,
      AccessPass: entryRes.AccessPass,
      JobCd: ENUMS.JobCd.Sales,
      Amount: amount
    }).then((alterRes) => {
      console.log(alterRes)
    })
  })
})

TypeScript

import GMOPG, {ENUMS} from 'gmopg'

const gmopg = new GMOPG({
  baseUrl: 'https://p01.mul-pay.jp',
  SiteID: 'Your SiteID',
  SitePass: 'Your SitePass',
  ShopID: 'Your ShopID',
  ShopPass: 'Your ShopPass'
})

const orderID = 'Order ID'
const amount = 1234

const entryRes = await gmopg.entryTran({
  OrderID: orderID,
  JobCd: ENUMS.JobCd.Auth,
  Amount: amount
})

const execRes = await gmopg.execTran({
  AccessID: entryRes.AccessID,
  AccessPass: entryRes.AccessPass,
  OrderID: orderID,
  Method: ENUMS.Method.Lump,
  CardNo: '1234123412341234',
  Expire: '2024',
  SecurityCode: '123'
})

const alterRes = await gmopg.alterTran({
  AccessID: entryRes.AccessID,
  AccessPass: entryRes.AccessPass,
  JobCd: ENUMS.JobCd.Sales,
  Amount: amount
})

Config

name description environ default
baseUrl baseurl for request GMOPG_ENDPOINT https://pt01.mul-pay.jp
http.timeout timeout for request GMOPG_TIMEOUT 180000 (ms)
http.headers headers for request - see code 👀
SiteID PG site id GMOPG_SITEID undefined
SitePass PG site pass GMOPG_SITEPASS undefined
ShopID PG shop id GMOPG_SHOPID undefined
ShopPass PG shop pass GMOPG_SHOPPASS undefined

Contribution

  1. Create a feature branch
  2. Commit your changes
  3. Run test suite with the npm run ci command and confirm that it passes
  4. Create a new Pull Request

About

💳 Simple Nodejs wrapper for GMO Payment Gateway API.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • TypeScript 100.0%