PHP code example of lovaszcc / laravel-barion
1. Go to this page and download the library: Download lovaszcc/laravel-barion 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/ */
lovaszcc / laravel-barion example snippets
return [
'live_env' => env('BARION_LIVE_ENV', false),
'pos_key' => env('BARION_POS_KEY'),
'callback_url' => env('BARION_CALLBACK_URL'),
'redirect_url' => env('BARION_REDIRECT_URL'),
'payee' => env('BARION_PAYEE'),
];
use LovaszCC\Barion\Enums\Currency;
use LovaszCC\Barion\Enums\FundingSources;
use LovaszCC\Barion\Enums\Locale;
use LovaszCC\Barion\Enums\PaymentType;
use LovaszCC\Barion\Facades\Barion;
$transaction_id = 'ORDER-1234567890';
$items = [
[
'Name' => 'Test item',
'Description' => 'Test item description',
'UnitPrice' => 1000,
'Quantity' => 1,
'Unit' => 'db',
'ItemTotal' => 1000,
],
[
'Name' => 'Test item2',
'Description' => 'Test item description2',
'UnitPrice' => 1000,
'Quantity' => 1,
'Unit' => 'db',
'ItemTotal' => 1000,
],
];
$data = [
'PaymentType' => PaymentType::IMMEDIATE,
'GuestCheckOut' => true,
'FundingSources' => [FundingSources::ALL],
'Locale' => Locale::HU,
'Currency' => Currency::HUF,
'RedirectUrl' => config('barion.redirect_url'),
'CallbackUrl' => config('barion.callback_url'),
'Transactions' => [
[
'POSTransactionId' => $transaction_id,
'Payee' => config('barion.payee'),
'Total' => 2000,
'Items' => $items,
],
],
];
// returns array with paymentId and GatewayUrl
dd(Barion::initPayment($data));
bash
php artisan vendor:publish --tag="barion-config"