@motionpicture/gmo-service

GMO Client Library for Node.js

Usage no npm install needed!

<script type="module">
  import motionpictureGmoService from 'https://cdn.skypack.dev/@motionpicture/gmo-service';
</script>

README

GMO Client Library for Node.js

npm (scoped) CircleCI Coverage Status Dependency Status npm

Node.jsでGMOサービスを使うためのパッケージです。

Table of contents

Usage

npm install @motionpicture/gmo-service
const GMO = require('@motionpicture/gmo-service');

When using the GMO Service SDK, you must provide connection information. This can be provided using:

Environment variables

Name Required Value Purpose
DEBUG false gmo-service:* Debug
GMO_ENDPOINT false GMO API endpoint

クレジットカード決済(即時売上)の例

const GMO = require('@motionpicture/gmo-service');

const orderId ='orderId';
const creditService = new GMO.service.Credit(
    { endpoint: process.env.GMO_ENDPOINT }
);
creditService.entryTran({
    shopId: 'your shopId',
    shopPass: 'sour shopPass',
    orderId: orderId,
    jobCd: GMO.utils.util.JobCd.Auth,
    amount: 1234
}).then((entryTranResult) => {
    console.log('entryTranResult:', entryTranResult);

    creditService.execTran({
        accessId: entryTranResult.accessId,
        accessPass: entryTranResult.accessPass,
        orderId: orderId,
        method: GMO.utils.util.Method.Lump,
        cardNo: '1234123412341234',
        expire: '2024',
        securityCode: '123'
    }).then((execTranResult) => {
        console.log('execTranResult:', execTranResult);

        creditService.alterTran({
            shopId: 'your shopId',
            shopPass: 'sour shopPass',
            accessId: entryTranResult.accessId,
            accessPass: entryTranResult.accessPass,
            jobCd: GMO.utils.util.JobCd.Sales,
            amount: amount
        }).then((alterTranResult) => {
            console.log('alterTranResult:', alterTranResult);
        });
    });
});

Code Samples

コードサンプルは example にあります。

Jsdoc

npm run docでjsdocを作成できます。./docに出力されます。

License

ISC