techlup/flutterwave 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

techlup/flutterwave

最新稳定版本:1.0

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

Donate with PayPal

Installation

  1. Clone this repository to your local machine.
  2. Navigate to the directory containing the cloned repository.
  3. Run composer install to 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_key variable 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

  1. Set up the required configuration as mentioned above.
  2. Call the desired function(s) based on your integration needs.
  3. 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.

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-03-07