Skip to content

Simple package to interact GMOPG API for laravel project

License

Notifications You must be signed in to change notification settings

nekoding/gmo-payment-gateway

Repository files navigation

GMOPG Package for Laravel

Latest Version on Packagist Total Downloads

Simple package to interact GMOPG API for laravel project

Installation

You can install the package via composer:

composer require nekoding/gmo-payment-gateway

Publish configuration file with

php artisan vendor:publish --provider="Nekoding\GmoPaymentGateway\GmoPaymentGatewayServiceProvider"

Usage

// Usage description here
// via GmoPaymentGateway Class

$gmo = new \Nekoding\GmoPaymentGateway\GmoPaymentGateway();

// if you want interact with GMO Site API use this
$siteApi = $gmo->useSiteApi();

// if you want interact with GMO Shop API use this
$shopApi = $gmo->useShopApi();

// Or you can use facade like this too
\Nekoding\GmoPaymentGateway\GmoPaymentGatewayFacade::useShopApi();
\Nekoding\GmoPaymentGateway\GmoPaymentGatewayFacade::useSiteApi();
\Nekoding\GmoPaymentGateway\GmoPaymentGatewayFacade::creditCard();

// If you want execution CreditCard EntryTran and CreditCard ExecTran at once 
// You can use CreditCard entryTransaction callback like this
use Nekoding\GmoPaymentGateway\Contracts\Shop\CreditCard\Basic;
use \Nekoding\GmoPaymentGateway\GmoPaymentGatewayFacade;

$data = ['OrderID' => uniqid(), 'JobCd' => 'AUTH', 'Amount' => 1000, 'Method' => '', 'Token' => ''];
$response = GmoPaymentGatewayFacade::creditCard()
            ->entryTransaction($data, function (Basic $gmo) use (&$data) {
                return $gmo->execTransaction($data);
            });

$response->getResult(); // it will return response from entry transaction and exec transaction process

// example response :
[
  "ACS" => "0"
  "OrderID" => "xxxx"
  "Forward" => "xxx"
  "Method" => "1"
  "PayTimes" => ""
  "Approve" => "xxx"
  "TranID" => "xxxx"
  "TranDate" => "xxxxx"
  "CheckString" => "xxxxx",
  "AccessID" => "xxxxx",
  "AccessPass" => "xxxx"
]

Configuration

You can change api credential via .env or via config/config.php

ENV Key Description
GMO_API_SANDBOX_MODE If true package will use sandbox endpoint instead production endpoint
GMO_SITE_ID Credential to connect GMO Site API
GMO_SITE_PASS Credential to connect GMO Site API
GMO_SHOP_ID Credential to connect GMO Shop API
GMO_SHOP_PASS Credential to connect GMO Shop API
GMO_3DS_VERSION 3DS API Version for credit card (only support value 1 / 2)
GMO_API_TIMEOUT Determine API Timeout (default: 2s)

Supported API

  • SiteAPI
  • ShopAPI - Credit card payment

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email enggartivandi@outlook.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

About

Simple package to interact GMOPG API for laravel project

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages