# gmopg

> GMO PaymentGateway API client

Latest version **6.0.0** (published 2021-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install gmopg
pnpm add gmopg
yarn add gmopg
bun add gmopg
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2021-05-19 |
| First published | 2017-10-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 207 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 37 |
| Author | linyows |
| Maintainers | linyows, k1low, dojineko, sunecosuri |
| Keywords | api, client, payment |

## Links

- npm: https://www.npmjs.com/package/gmopg
- Repository: https://github.com/pepabo/gmopg
- Issues: https://github.com/pepabo/gmopg/issues
- npm.io page: https://npm.io/package/gmopg

## Dependencies (3)

- [qs](https://npm.io/package/qs.md) ^6.9.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0
- [encoding-japanese](https://npm.io/package/encoding-japanese.md) ^1.0.30

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 6.0.0 (latest) — 2021-05-19
- 5.0.1 — 2020-08-31
- 5.0.0 — 2020-08-20
- 4.1.0 — 2020-07-29
- 4.0.0 — 2019-12-04
- 3.4.1 — 2019-10-23
- 3.4.0 — 2019-10-18
- 3.3.0 — 2019-10-16
- 3.2.0 — 2019-08-06
- 3.1.0 — 2019-06-26
- 3.0.1 — 2019-06-12
- 3.0.0 — 2019-06-12
- 2.0.0 — 2019-06-12
- 1.2.0 — 2019-06-04
- 1.1.0 — 2019-06-03
- … 33 more at https://npm.io/package/gmopg/versions

## README

GMO Payment Gateway API Client: Unofficial
==========================================

Simple Nodejs wrapper for [GMO Payment Gateway][gmopg] API.

<a href="https://www.npmjs.com/package/gmopg" title="npm"><img src="http://img.shields.io/npm/v/gmopg.svg?style=for-the-badge"></a>
<a href="https://github.com/pepabo/gmopg/actions" title="actions"><img src="https://img.shields.io/github/workflow/status/pepabo/gmopg/Build?style=for-the-badge"></a>
<a href="https://codecov.io/gh/pepabo/gmopg" title="codecov.io"><img src="https://img.shields.io/codecov/c/gh/pepabo/gmopg.svg?style=for-the-badge"></a>
<a href="https://github.com/pepabo/gmopg/blob/master/MIT-LICENSE" title="MIT License"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge"></a>

[gmopg]: https://www.gmo-pg.com/

Installation
------------

```sh
$ npm install gmopg
```

Usage
-----

Purchase example

### Node.js

```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

```ts
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 :eyes:
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)
1. Create a feature branch
1. Commit your changes
1. Rebase your local changes against the master branch
1. Run test suite with the `npm ci` command and confirm that it passes
1. Create a new Pull Request

Author
------

[linyows](https://github.com/linyows)

---
_Source: https://npm.io/package/gmopg · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
