Coder Social home page Coder Social logo

yuichkun / gmopg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pepabo/gmopg

0.0 1.0 0.0 238 KB

:credit_card: Simple Nodejs wrapper for GMO Payment Gateway API.

Home Page: https://www.gmo-pg.com/

License: MIT License

TypeScript 100.00%

gmopg's Introduction

GMO Payment Gateway API Client: Unofficial

Simple Nodejs wrapper for GMO Payment Gateway API.

Installation

$ npm install gmopg

Usage

Purchase example

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. Fork (https://github.com/pepabo/gmopg/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the npm ci command and confirm that it passes
  6. Create a new Pull Request

Author

linyows

gmopg's People

Contributors

linyows avatar hojin-choi avatar caub avatar k1low avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.