devadze/laravel-flitt-payment
最新稳定版本:1.0.7
Composer 安装命令:
composer require devadze/laravel-flitt-payment
包简介
A Laravel package for Flitt Payment API integration
README 文档
README
A simple and elegant Laravel package for integrating the Flitt Payment Gateway into your Laravel application.
🚀 Features
- Seamless Flitt payment integration
- Clean fluent API via Facade (
Flitt::setAmount(...)->redirect()) - Automatic signature generation
- Callback URL handling
- Configurable merchant settings
- Extendable via service class, trait, and contract
📦 Installation
Install the package via Composer:
You can install the package via composer:
composer require devadze/laravel-flitt-payment
You can publish the config file with:
php artisan vendor:publish --provider="Devadze\FlittPayment\FlittPaymentServiceProvider"
Once published, the configuration file will be available at:
config/flitt.php
And run migrations:
php artisan migrate
Environment Variables
Add the following variables to your .env file to configure the package:
FLITT_MERCHANT_ID=your_merchant_id FLITT_SECRET_KEY=your_secret_key FLITT_RESPONSE_URL=https://yourdomain.ge FLITT_CALLBACK_URL=https://yourdomain.ge/flitt/callback # Used only if custom callback is needed
Usage
Usage Example: Simple Payment Processing
To initiate a payment, use the FlittPayment facade to set the order details and redirect:
use Devadze\FlittPayment\Facades\FlittPayment; $response = FlittPayment::setOrderDesc('ბალანსის შევსება')->setAmount(5)->redirect(); return redirect($response['checkout_url']);
Callback Handling
The package handles callback behavior automatically. When a payment is processed, it will send a POST request to your callback URL with the payment details.
Example: Registering a Listener for Flitt Payment Updates Add the following code to your event listener:
namespace App\Listeners; use Devadze\FlittPayment\Events\PaymentReceived; use Illuminate\Support\Facades\Log; class HandleFlittPayment { /** * Create the event listener. */ public function __construct() { // } /** * Handle the event. */ public function handle(PaymentReceived $event): void { // implement your login code Log::info('Flitt payment callback received', $event->response); # you can remove it } }
Setting Up the Event Listener
Setting Up the Event Listener To handle transaction status updates efficiently, you need to register an event listener that listens for the HandleFlittPayment event triggered by the package.
Generating the Listener Automatically You can generate the event listener using the Artisan command:
php artisan make:listener HandleFlittPayment --event=\Devadze\FlittPayment\Events\PaymentReceived
This command will create a listener class at app/Listeners/HandleFlittPayment.php, which you can customize to handle the event logic.
This approach provides flexibility by allowing dynamic event registrations at runtime without modifying the EventServiceProvider.
For more details on event handling in Laravel, refer to the official documentation.
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-09