deh4eg / omnipay-kevin
Kevin gateway based on omnipay library
v2.0.1
2022-09-24 23:36 UTC
Requires
- php: ^7.2
- omnipay/common: ^3.0
Requires (Dev)
- omnipay/tests: ^3.1
- phpro/grumphp: ^0.19.1
- phpstan/phpstan: ^0.12.82
- squizlabs/php_codesniffer: ^3.5
README
Omnipay Kevin Gateway is a payment processing library for PHP. It's based on Omnipay package
Installation
Omnipay is installed via Composer. To install, simply require league/omnipay
and deh4eg/omnipay-kevin
with Composer:
composer require league/omnipay deh4eg/omnipay-kevin
API docs
Kevin gateway API documentation you can find here
Usage
For general usage instructions, please see the main Omnipay repository.
Currently, library implements 2 endpoints:
Code Examples
1. Initiate 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@email.com' ], '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(); }
2. Get payment 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 }
Changelog
Please see CHANGELOG for more information what has changed recently.
License
The MIT License (MIT). Please see License File for more information.