lovaszcc / laravel-barion
This is my package laravel-barion
Fund package maintenance!
Lovász Krisztián
Requires
- php: ^8.3
- illuminate/contracts: ^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
This package is not auto-updated.
Last update: 2025-08-26 11:08:14 UTC
README
Installation
You can install the package via composer:
composer require lovaszcc/laravel-barion
You can publish the config file with:
php artisan vendor:publish --tag="barion-config"
This is the contents of the published config file:
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'), ];
Usage
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));
Steps to Use
- Create a new payment
- Redirect the user to the GatewayUrl
- Wait for the callback
- Get the payment status
- If the payment is successful, update the order status
- If the payment is failed, update the order status
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.