PHP code example of nekoding / gmo-payment-gateway
1. Go to this page and download the library: Download nekoding/gmo-payment-gateway library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nekoding / gmo-payment-gateway example snippets
// 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"
]