PHP code example of deh4eg / omnipay-luminor

1. Go to this page and download the library: Download deh4eg/omnipay-luminor 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/ */

    

deh4eg / omnipay-luminor example snippets


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' => '[email protected]'
    ],
    '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();
}

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
}