bhekor/laravel-flutterwave
Composer 安装命令:
composer require bhekor/laravel-flutterwave
包简介
Laravel package for flutterwave
关键字:
README 文档
README
Implement Flutterwave Rave payment gateway easily with Laravel
- Go to Flutterwave to get your public and private key
To get the latest version of this Flutterwave package, simply use composer
composer require bhekor/laravel-flutterwave
Then publish the configuration file using this command:
php artisan vendor:publish --provider="Bhekor\LaravelFlutterwave\FlutterwaveServiceProvider"
Open your .env file and add your public key, secret key, environment variable and logo url like so:
FLW_PUBLIC_KEY=FLWPUBK-xxxxxxxxxxxxxxxxxxxxx-X FLW_SECRET_KEY=FLWSECK-xxxxxxxxxxxxxxxxxxxxx-X FLW_SECRET_HASH='awesome-project'
-
FLW_PUBLIC_KEY - This is the api public key gotten from your dashboard (compulsory)
-
FLW_SECRET_KEY - This is the api secret key gotten from your dashboard (compulsory)
-
FLW_SECRET_HASH - This is the secret hash for your webhook
welcome.blade.php
<h3>Buy Movie Tickets N500.00</h3> <form method="POST" action="{{ route('pay') }}" id="paymentForm"> {{ csrf_field() }} <input name="name" placeholder="Name" /> <input name="email" type="email" placeholder="Your Email" /> <input name="phone" type="tel" placeholder="Phone number" /> <input type="submit" value="Buy" /> </form>
Setup your controller to handle the routes. FlutterwaveController. Then import the Flutterwave facade
<?php namespace App\Http\Controllers; use Bhekor\LaravelFlutterwave\Facades\Flutterwave; class FlutterwaveController extends Controller { /** * Initialize Rave payment process * @return void */ public function initialize() { //This generates a payment reference $reference = Flutterwave::generateReference(); // Enter the details of the payment $data = [ 'payment_options' => 'card,banktransfer', 'amount' => 500, 'email' => request()->email, 'tx_ref' => $reference, 'currency' => "NGN", 'redirect_url' => route('callback'), 'customer' => [ 'email' => request()->email, "phone_number" => request()->phone, "name" => request()->name ], "customizations" => [ "title" => 'Movie Ticket', "description" => "20th October" ] ]; $payment = Flutterwave::initializePayment($data); if ($payment['status'] !== 'success') { // notify something went wrong return; } return redirect($payment['data']['link']); } /** * Obtain Rave callback information * @return void */ public function callback() { $status = request()->status; //if payment is successful if ($status == 'successful') { $transactionID = Flutterwave::getTransactionIDFromCallback(); $data = Flutterwave::verifyTransaction($transactionID); dd($data); } elseif ($status == 'cancelled'){ //Put desired action/code after transaction has been cancelled here } else{ //Put desired action/code after transaction has failed here } // Get the transaction from your DB using the transaction reference (txref) // Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue // Confirm that the currency on your db transaction is equal to the returned currency // Confirm that the db transaction amount is equal to the returned amount // Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose) // Give value for the transaction // Update the transaction to note that you have given value for the transaction // You can also redirect to your success page from here } }
Setup the Routes
// The page that displays the payment form Route::get('/', function () { return view('welcome'); }); // The route that the button calls to initialize payment Route::post('/pay', [FlutterwaveController::class, 'initialize'])->name('pay'); // The callback url after a payment Route::get('/rave/callback', [FlutterwaveController::class, 'callback'])->name('callback');
Documentation
A friendly documentation from a package that this was created from can be found here
Contributing
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities. I will appreciate that a lot. Also please add your name to the credits.
Kindly follow me on twitter!
Features
The current features have been implemented
- Payment
- Verification
- Transfers
- Banks
- Beneficiaries
I will be working on this next
- Tokenized Charge
- Pre Auth Charge
If there are features you need urgently, I will be willing to prioritize them, please reach out to my twitter account
License
The MIT License (MIT). Please see License File for more information.
bhekor/laravel-flutterwave 适用场景与选型建议
bhekor/laravel-flutterwave 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.45k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2022 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「flutterwave」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bhekor/laravel-flutterwave 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bhekor/laravel-flutterwave 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bhekor/laravel-flutterwave 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel wrapper for the flutterwave-php library
Feature-based billing for Laravel with African payment provider support (M-Pesa, Paystack, Flutterwave, Pesapal). Plans, feature gating, usage metering, subscriptions, and invoicing.
PHP wrapper for the Moneywave API
Modern Laravel package for Flutterwave v4 API integration
This is developed for easy integration of flutterwave APIs with laravel v5.* to latest.
A Testimplementation of the Moneywave API emmanix2002 by Flutterwave
统计信息
- 总下载量: 1.45k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-03-08