1. Go to this page and download the library: Download kevujin/comgate-client 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/ */
kevujin / comgate-client example snippets
use Comgate\Client;
$client = new Client(
'merchant', // your merchant ID you got from Comgate
true, // if testing environment -> false = production
'secret' // secret passphrase/token you got from Comgate
);
use Comgate\Request\CreatePayment;
$createPayment = new CreatePayment(
1000, // the price in cents 10.00 => 1000
'orderId', // your ID
'[email protected]', // email of customer or some email for Comgate to communicate with if payment problems
'Product name' // payment label
);
$createPaymentResponse = $client->send($createPayment);
$redirectUrl = $createPaymentResponse->getRedirectUrl();
use Comgate\Request\PaymentStatus;
$paymentStatus = new PaymentStatus(
'transId' // Comgate ID you received from create payment process
);
$paymentStatusResponse = $client->send($paymentStatus);
use Comgate\Request\CancelPayment;
$cancelPayment = new CancelPayment(
'transId' // Comgate ID you received from create payment process
);
$cancelPaymentResponse = $client->send($cancelPayment);
use Comgate\Request\GetMethods;
$getMethods = new GetMethods(
'currency', // currency to filter methods for, could be null to match all available
'country' // country to filter methods available in, could be null to match all available
);
$getMethodsResponse = $client->send($getMethods);
var_dump($getMethodsResponse->methods);
var_dump($getMethodsResponse->getMethod('BANK_ALL')); // exact one method
use Comgate\Request\ListTransfers;
$listTransfers = new ListTransfers(
date('Y-m-d') // let's look for today
);
$listTransfersResponse = $client->send($listTransfers);
var_dump($listTransfersResponse->transfers); // collection of Response\Item\Transfer
foreach ($listTransfersResponse->transfers as $transfer) { // transfer is object Response\Item\Transfer
$getTransferRequest = $transfer->createRequest(); // Request\GetTransfer
$getTransferResponse = $client->send($getTransferRequest);
var_dump($getTransferResponse->transferItems); // collection of Response\Item\TransferItem
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.