nekoding/gmo-payment-gateway

Simple package to interact GMOPG API for laravel project

v1.2.0 2022-04-08 06:17 UTC

This package is auto-updated.

Last update: 2024-11-05 02:37:26 UTC


README

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

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.