Paysera gateway driver for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Paysera support for Omnipay.
Omnipay is installed via Composer. To install, require league/omnipay
and semyonchetvertnyh/omnipay-paysera
with Composer:
composer require league/omnipay semyonchetvertnyh/omnipay-paysera
For general usage instructions, please see the main Omnipay repository.
- PHP 7.0+
- Omnipay v3+
- ext-openssl
The following gateways are provided by this package:
- Paysera
For general usage instructions, please see the main Omnipay repository.
use Omnipay\Omnipay;
// Setup payment gateway
$gateway = Omnipay::create('Paysera');
$gateway->setProjectId('123456');
$gateway->setPassword('abcde12345');
// Optionally to determine which order has been paid
$orderId = 1;
// Example card (actually customer) data
$card = [
'email' => '[email protected]',
'billingFirstName' => 'John',
'billingLastName' => 'Doe',
'billingPhone' => '+372 12345678',
'billingCompany' => 'Good Workers Ltd.',
'billingAddress1' => 'Viru valjak 24',
'billingCity' => 'Tallinn',
'billingPostcode' => '123456',
'billingCountry' => 'EE',
];
// Send purchase request
$response = $gateway->purchase(
[
'language' => 'ENG',
'transactionId' => $orderId,
'paymentMethod' => 'hanzaee',
'amount' => '10.00',
'currency' => 'EUR',
'returnUrl' => "https://example.com/paysera/return/{$orderId}",
'cancelUrl' => "https://example.com/paysera/cancel/{$orderId}",
'notifyUrl' => "https://example.com/paysera/notify/{$orderId}",
'card' => $card,
]
)->send();
if ($response->isRedirect()) {
return $response->redirect();
}
You should also implement method for notifyUrl
. After successful charging, Paysera sends a request to this URL.
use Omnipay\Omnipay;
// Setup payment gateway
$gateway = Omnipay::create('Paysera');
$gateway->setProjectId('123456');
$gateway->setPassword('abcde12345');
// Accept the notification
$response = $gateway->acceptNotification()
->send();
if ($response->isSuccessful()) {
// Mark the order as paid
return true;
}
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.