1. Go to this page and download the library: Download floodx92/kh-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/ */
floodx92 / kh-gateway example snippets
use Floodx92\KhGateway\Util\CurlHttpClient;
use Floodx92\KhGateway\Crypto\OpenSSLAdapter;
use Floodx92\KhGateway\ApiService;
use Floodx92\KhGateway\Storage\FileKeyStorage;
// Instantiate the Http client, with the API URL
$client = CurlHttpClient::make(ApiService::SANDBOX_URL);
//client = CurlHttpClient::make(ApiService::PRODUCTION_URL);
// For the OpenSSLAdapter, first we need a KeyStore
$keyStore = FileKeyStorage::make(
'path/to/your/private.key',
'path/to/your/public.key',
//optionally you can pass a passphrase as last argument
)
$adapter = OpenSSLAdapter::make($keyStore, $verifySignature = true);
use Floodx92\KhGateway\ApiService;
use Floodx92\KhGateway\Model\Request\EchoRequest;
use Floodx92\KhGateway\Exception\HttpException;
$api = ApiService::make($adapter, $client);
// Send an Echo request
$echoRequest = EchoRequest::make($merchantId = 'ABC123456')
try {
$echoResult = $api->echo($echoRequest);
echo $echoResult->resultCode;
} catch (HttpException $e) {
// Handle the exception
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.