deh4eg / omnipay-luminor
Luminor gateway for omnipay library
v2.0.0
2021-03-15 10:44 UTC
Requires
- php: ^7.2
- ext-json: *
- league/omnipay: ^3
Requires (Dev)
- omnipay/tests: ^3
- phpro/grumphp: ^1.3
- phpstan/phpstan: ^0.12.81
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-10-15 19:47:42 UTC
README
Omnipay Luminor 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-luminor
with Composer:
composer require league/omnipay deh4eg/omnipay-luminor
API docs
Luminor 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. Create a Purchase
use Omnipay\Luminor\Gateway; use Omnipay\Luminor\Message\Response\PurchaseResponse; use Omnipay\Omnipay; /** @var Gateway $gateway */ $gateway = Omnipay::create(Gateway::getGatewayClass()); $gateway->setBrandId('123456789'); $gateway->setSecretKey('abcde123456'); $options = [ 'client' => [ 'email' => 'test@test.com' ], 'purchase' => [ 'currency' => 'EUR', // Currency code in the ISO 4217 standard, 'language' => 'lv', // Language code in the ISO 639-1 format 'total_override' => 100, // (optional) [type: int] If set, will override total sum from products[], 'products' => [ [ 'name' => 'Product name', 'price' => 100, // [type: int], 'quantity' => 1 ] ] ], 'success_redirect' => 'https://www.example.com/success/', 'failure_redirect' => 'https://www.example.com/failure/', 'cancel_redirect' => 'https://www.example.com/cancel/' // (optional) ]; /** @var PurchaseResponse $response */ $response = $gateway->completePurchase($options)->send(); if ($response->isRedirect()) { $response->redirect(); }
2. Retrieve an object by id
use Omnipay\Luminor\Gateway; use Omnipay\Luminor\Message\Response\FetchTransactionResponse; use Omnipay\Omnipay; /** @var Gateway $gateway */ $gateway = Omnipay::create(Gateway::getGatewayClass()); $gateway->setBrandId('123456789'); $gateway->setSecretKey('abcde123456'); $options = [ 'transaction_reference' => 'abc123' // Object ID (UUID) from purchase response ]; /** @var FetchTransactionResponse $response */ $response = $gateway->fetchTransaction($options)->send(); if ($response->isSuccessful()) { // Do code }
Changelog
Please see CHANGELOG for more information what has changed recently.
License
The MIT License (MIT). Please see License File for more information.