PHPackages                             sanmai/gmopg - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. sanmai/gmopg

AbandonedArchivedLibrary

sanmai/gmopg
============

GMO Payment Gateway API for simple credit card payments

v1.1.3(6y ago)131.1k6MITPHPPHP ^7.0

Since Nov 28Pushed 6y ago2 watchersCompare

[ Source](https://github.com/sanmai/gmopg)[ Packagist](https://packagist.org/packages/sanmai/gmopg)[ RSS](/packages/sanmai-gmopg/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (5)Versions (6)Used By (0)

[![Build Status](https://camo.githubusercontent.com/86a0e853b3d3309dc7eee7d9608ab6ff60dc061328d00df2ac23fd6b3f40e2ff/68747470733a2f2f7472617669732d63692e6f72672f73616e6d61692f676d6f70672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sanmai/gmopg)[![Coverage Status](https://camo.githubusercontent.com/ac341f927046cbc73aaf2a5c2b8bbc4a634fce8e218e7bc723cdeecf4fb21cbc/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73616e6d61692f676d6f70672f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/sanmai/gmopg?branch=master)[![Maintainability](https://camo.githubusercontent.com/9dfdc491e90b7ecedcab2329e23614a798e907d1d94af41d311d926b10835c85/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39366133303961306430616436326334316465362f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/sanmai/gmopg/maintainability)[![Latest Stable Version](https://camo.githubusercontent.com/29f4dc5c3d96f16d277d95cdddff6a06776c598b2505f9b9f9073af5ccbce0d6/68747470733a2f2f706f7365722e707567782e6f72672f73616e6d61692f676d6f70672f76657273696f6e)](https://packagist.org/packages/sanmai/gmopg)[![License](https://camo.githubusercontent.com/8d4bbc705a65dde198696ad050aad20486c0dceced24c21ea530583735181784/68747470733a2f2f706f7365722e707567782e6f72672f73616e6d61692f676d6f70672f6c6963656e7365)](https://packagist.org/packages/sanmai/gmopg)

Installation
============

[](#installation)

```
composer require sanmai/gmopg

```

Configuration
=============

[](#configuration)

There are two ways to configure the API:

1. With global constants. Namely, you need to have defined:

    ```
      // ショップ情報
    define('GMO_SHOP_ID', 'tshop0000001'); // ショップＩＤ
    define('GMO_SHOP_PASSWORD', 'qwerty'); // ショップ名
    define('GMO_SHOP_NAME', 'My Shop'); // ショップパスワード
    define('GMO_TRIAL_MODE', false);
    ```

    Where first three you can get from the management panel or from emails from GMO PG.

    The last constant `GMO_TRIAL_MODE` should be set to `true` if you're using a test shop password.
2. By calling these static methods:

    ```
    \GMO\API\Defaults::setShopID($shopId);
    \GMO\API\Defaults::setShopName($shopName);
    \GMO\API\Defaults::setPassword($shopPassword);

    // When using a test password, this constant is mandatory
    //define('GMO_TRIAL_MODE', true);
    ```

Testing payments
----------------

[](#testing-payments)

Currently there is no other way to enable a test mode other than by defining a constant `GMO_TRIAL_MODE` set to `true`.

```
define('GMO_TRIAL_MODE', true);
```

Testing payments with directly-entered card numbers with test environment credentials requires you to [enable such payments as outlined in the documentation](https://faq.gmo-pg.com/service/Detail.aspx?id=2043&page=0&listNo=0&category=0).

Basic usage
===========

[](#basic-usage)

```
// A wrapper object that does everything for you.
$payment = new \GMO\ImmediatePayment();
 // Unique ID for every payment; probably should be taken from an auto-increment field from the database.
$payment->paymentId = 123;
$payment->amount = 1000;
// This card number can be used for tests.
$payment->cardNumber = '4111111111111111';
// A date in the future.
$payment->cardYear = '2020';
$payment->cardMonth = '7';
$payment->cardCode = '123';

// Returns false on an error.
if (!$payment->execute()) {
	$errors = $payment->getErrors();
	foreach ($errors as $errorCode => $errorDescription) {
        // Show an error code and a description to the customer? Your choice.
        // Probably you want to log the error too.
	}
	return;
}

// Success!
$response = $payment->getResponse();
/** @var \GMO\API\Response\ExecTranResponse $response */
// You would probably want to save the response in the database for future reference.
// The response can be used to query details about a transaction, make refunds and so on.
```

Array of `$errors` comes in a form similar to this:

```
array(1) {
  'E01040010' =>
  string(34) "This order ID was used previously."
}

```

[A list of most known error codes.](https://faq.gmo-pg.com/service/Detail.aspx?id=480&printMode=1) [In a readable form.](https://github.com/fumikito/Literally-WordPress/blob/master/class/payment/gmo_error_handler.php) [And another.](https://github.com/everright/gmo-pg-php/blob/master/src/GMO/Payment/Consts.php)

A typical `$response` will look like so:

```
class GMO\API\Response\ExecTranResponse#1 (9) {
  public $ACS =>
  string(1) "0"
  public $OrderID =>
  string(10) "1517000000"
  public $Forward =>
  string(7) "0afd1200"
  public $Method =>
  string(1) "1"
  public $PayTimes =>
  string(0) ""
  public $Approve =>
  string(7) "0112234"
  public $TranID =>
  string(28) "180111111111111111111344439"
  public $TranDate =>
  string(14) "20221222213141"
  public $CheckString =>
  string(32) "68b329da9893e34099c7d8ad5cb9c940"
}

```

Paying with a token
-------------------

[](#paying-with-a-token)

A payment object can accept a token received from the JavaScript API instead of credit card details:

```
$payment = new \GMO\ImmediatePayment();
$payment->paymentId = 123; // Unique ID for every payment; see above
$payment->amount = 1000;
// Card details are unnecessary in this case
$payment->token = $_POST['token'];

if (!$payment->execute()) {
    // ... same as above
}

// ... same as above
```

One should use the above method of payment if they're getting the venerable error E61040001.

Transaction details
-------------------

[](#transaction-details)

Now you naturally want to load transaction details for the current payment.

```
$searchTrade = new \GMO\API\Call\SearchTrade();
$searchTrade->OrderID = $payment->getResponse()->OrderID;
// Copy credential from the original payment
$payment->setupOther($searchTrade);

$response = $searchTrade->dispatch();
```

In this `$response` you would find these fields:

```
class GMO\API\Response\SearchTradeResponse#4950 (21) {
  public $AccessID =>
  string(32) "b026324c6904b2a9cb4b88d6d61c81d1"
  public $AccessPass =>
  string(32) "26ab0db90d72e28ad0ba1e22ee510510"
  public $OrderID =>
  string(10) "1517000000"
  public $Status =>
  string(5) "SALES"
  public $ProcessDate =>
  string(14) "20221222213141"
  public $JobCd =>
  string(5) "SALES"
  public $ItemCode =>
  string(7) "0000000"
  public $Amount =>
  string(4) "4999"
  public $Tax =>
  string(1) "0"
  public $SiteID =>
  string(0) ""
  public $MemberID =>
  string(0) ""
  public $CardNo =>
  string(16) "************1111"
  public $Expire =>
  string(4) "2307"
  public $Method =>
  string(1) "1"
  public $PayTimes =>
  string(0) ""
  public $Forward =>
  string(7) "0afd1200"
  public $TranID =>
  string(28) "180111111111111111111344439"
  public $Approve =>
  string(7) "0112234"
  public $ClientField1 =>
  string(0) ""
  public $ClientField2 =>
  string(0) ""
  public $ClientField3 =>
  string(0) ""
}

```

Futher API Documentation
========================

[](#futher-api-documentation)

GMO-PG is very secretive seemingly for no reason at all (that's [a complete opposite of Stripe](https://stripe.com/docs)), and typically you can only access their documentation upon signing a non-disclosure agreement.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 98% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~134 days

Total

5

Last Release

2546d ago

PHP version history (2 changes)v1.1.2PHP &gt;=5.6.30

v1.1.3PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/edcb8dde95c71b1c97c3c91e57d3548795fa2014c657744fb878e2be3b5949fc?d=identicon)[sanmai](/maintainers/sanmai)

---

Top Contributors

[![sanmai](https://avatars.githubusercontent.com/u/139488?v=4)](https://github.com/sanmai "sanmai (48 commits)")[![stickler-ci](https://avatars.githubusercontent.com/u/16011037?v=4)](https://github.com/stickler-ci "stickler-ci (1 commits)")

---

Tags

payment-gatewayphp-library

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/sanmai-gmopg/health.svg)

```
[![Health](https://phpackages.com/badges/sanmai-gmopg/health.svg)](https://phpackages.com/packages/sanmai-gmopg)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k20](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
