Omnipay Kevin Gateway is a payment processing library for PHP. It's based on Omnipay package
Omnipay is installed via Composer. To install, simply require league/omnipay
and deh4eg/omnipay-kevin
with Composer:
composer require league/omnipay deh4eg/omnipay-kevin
Kevin gateway API documentation you can find here
For general usage instructions, please see the main Omnipay repository.
Currently, library implements 2 endpoints:
Method | Endpoint |
---|---|
POST |
/pis/payment |
use Omnipay\Kevin\Gateway;
use Omnipay\Kevin\Message\Response\PurchaseResponse;
use Omnipay\Omnipay;
/** @var Gateway $gateway */
$gateway = Omnipay::create(Gateway::getGatewayShortName());
$gateway
->setClientId('123456789')
->setClientSecret('123456789abcdefg');
$options = [
'amount' => '13.13',
'currencyCode' => 'EUR', // 3 letter currency code (ISO 4217)
'description' => 'Testing',
'bankPaymentMethod' => [
'endToEndId' => 'order-123', // Max 33 symbols,
'informationUnstructured' => [
'reference' => 'order-123'
],
'iban' => 'AA13AAAA123456789',
'creditorName' => 'Name Surname',
'creditorAccount' => [ // Must contain at least one of [iban, bban, sortCodeAccountNumber]
'iban' => 'AA13AAAA123456789'
]
],
'identifier' => [
'email' => '[email protected]'
],
'cardPaymentMethod' => [], // (optional) To enable card payments
'redirectUrl' => 'https://example.com/result.php?gateway=Kevin',
'language' => 'lv', // (optional) Gateway UI language; Available - (en, lt, lv, et, fi, se, ru); Default - en
'webhookUrl' => 'https://example.com/webhook.php?gateway=Kevin' // (optional) For more details please see https://developer.kevin.eu/platform/payments/payment-verification
];
/** @var PurchaseResponse $response */
$response = $gateway->completePurchase($options)->send();
if ($response->isRedirect()) {
$response->redirect();
}
Method | Endpoint |
---|---|
GET |
/pis/payment/{paymentId}/status |
use Omnipay\Kevin\Gateway;
use Omnipay\Kevin\Message\Response\FetchTransactionResponse;
use Omnipay\Omnipay;
/** @var Gateway $gateway */
$gateway = Omnipay::create(Gateway::getGatewayShortName());
$gateway
->setClientId('123456789')
->setClientSecret('123456789abcdefg');
$options = [
'paymentId' => '13' // Payment identification from 'Initiate payment'
];
/** @var FetchTransactionResponse $response */
$response = $gateway->fetchTransaction($options)->send();
if ($response->isSuccessful() && $response->isPaymentCompleted()) {
// TODO: Payment completed
}
Please see CHANGELOG for more information what has changed recently.
The MIT License (MIT). Please see License File for more information.