techlup/flutterwave
Composer 安装命令:
composer require techlup/flutterwave
包简介
php checkout library
README 文档
README
This PHP script provides a demonstration of integrating with the FlutterWave API for handling subscription, deactivating subscriptions, and payments.
Support This Project
Installation
- Clone this repository to your local machine.
- Navigate to the directory containing the cloned repository.
- Run
composer installto install the required dependencies.
or install using composer composer require techlup/flutterwave
Configuration
- Ensure you have a FlutterWave account and obtain the required API keys.
- Set your FlutterWave secret key in the
$secrete_keyvariable inside the script.
Functions
Create a Customer
- Description: Creates a new customer in the FlutterWave system.
- Parameters:
$email: Email address of the customer.$firstName: First name of the customer.$lastName: Last name of the customer.
- Returns: JSON response containing the details of the created customer.
Sample Code
// Define customer details $email = 'user@example.com'; $firstName = 'John'; $lastName = 'Doe'; // Create a new customer $customer = new \Techlup\FlutterWave\Customer(); $customer->email = $email; $customer->first_name = $firstName; $customer->last_name= $lastName;
Subscribe A User
- Description: Initiates a subscription checkout process for a customer.
- Parameters: None
- Returns: JSON response containing the checkout details.
Sample Code
$subscription = new \Techlup\FlutterWave\Subscription($secrete_key); $response = $subscription->setRedirectUrl($redirect_url) ->setCustomer($customer) ->setPlanId('117407') ->setRef('test') ->setAmount(10) ->setCurrency('KES') ->checkout(); print_r($response);
Deactivate Subscription
- Description: Deactivates a subscription.
- Parameters: None
- Returns: JSON response confirming the deactivation of the subscription.
Sample Code
$subscription = new \Techlup\FlutterWave\Subscription($secrete_key); $response = $subscription->deactivate('127064'); print_r($response);
Process Payment
- Description: Initiates a payment checkout process.
- Parameters: None
- Returns: JSON response containing the checkout details.
Sample Code
$payment = new \Techlup\FlutterWave\Payment($secrete_key); $response = $payment->setAmount(10) ->setRef('test') ->setCurrency('KES') ->setOptions('card') ->setRedirectUrl($redirect_url) ->setCustomer($customer) ->checkout(); print_r($response);
Usage
- Set up the required configuration as mentioned above.
- Call the desired function(s) based on your integration needs.
- Handle the responses accordingly in your application.
Note
- This code is provided for testing purposes and should be thoroughly reviewed, modified, and secured before use in a production environment.
- Ensure that your FlutterWave account is properly configured with the necessary plans and payment options.
- Handle the responses appropriately in your application to provide feedback to users.
- Make sure to sanitize and validate user inputs before passing them to these functions to prevent security vulnerabilities.
techlup/flutterwave 适用场景与选型建议
techlup/flutterwave 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 03 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 techlup/flutterwave 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 techlup/flutterwave 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-03-07