obinnaakaolisa/flutterwave-pay 问题修复 & 功能扩展

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

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

obinnaakaolisa/flutterwave-pay

Composer 安装命令:

composer require obinnaakaolisa/flutterwave-pay

包简介

This is a PHP package for intializing and verifying Fluttwerwave transactions via the Flutterwave transactions API

README 文档

README

This is a PHP package for intializing and verifying Flutterwave transactions via the Flutterave transactions API

Requirements

The package requires the folowing resources:

  1. PHP ^8.0
  2. Composer
  3. Curl

Getting started

Installation

Navigate to your project's directory

    cd folder/my-project

In your project folder, run the following command

    composer require obinnaakaolisa/flutterwave-pay

Set your api key

    $apiKey = "FLWSECK_TEST-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-X";

Instantiate a new transaction object

Pass in the API_KEY upon instantiation.

    $transaction = new FlutterwavePay($apiKey);

Define your payload data for a POST request.

    $payload = [
    'tx_ref' => 'FLW_TEST_'.bin2hex(random_bytes(5)),
    'amount' => 2000, //in naira
    'redirect_url' => "https://{$_SERVER['SERVER_NAME']}/verify.php",
    'currency' => 'NGN',
    'customer' => [
        'name' => 'Firstname' .' '.'Lastname',
        'email' => 'customer@email.com',
        'phone_number' => '08031010101',
    ],
    'payment_options' => "card, banktransfer, ussd",
    'customizations' => [
        'title' => 'Some Payment',
    ],
    'meta' => [
        'field_name' => 'field_value',
    ],
    'subaccounts' => []
];

Note:

  1. The customizations field is optional. Define it if you want to customize the look and feel of the payment page. See documentation for reference.
  2. The subaccounts field is optional. It is only defined when you want to split the transaction into different settlement accounts. See documentation for reference.
  3. The meta field is optional. It is only defined when you want to save additional info about the customer or the transaction. See documentation for reference.

Intialize the transaction

The response you get for a request is a json encoded object, so you need to decode it thus:

$response = json_decode($transaction->initialize($payload));

or

$request = $transaction->initialize($payload);

$response = json_decode($request);

Verifying a transaction

Upon a successfull transaction or close of the payment page, the customer will be redirected to the redirect_url you set when initiating the transaction. Normally, that's the url where you'll verify the status of the transaction.

It is advised to verify a transaction before you give value to the customer.

Define your API_KEY

    $apiKey = "FLWSECK_TEST-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-X";

Instantiate a new transaction object and pass in the API_KEY upon instantiation.

    $transaction = new FlutterwavePay($apiKey);

Pass in the transaction reference that was defined while intiating the transaction.

You can also get this from the query parameter of the get request returned along with the redirect_url.

$response = json_decode($transaction->verify($_GET['tx_ref']));

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

License

MIT

obinnaakaolisa/flutterwave-pay 适用场景与选型建议

obinnaakaolisa/flutterwave-pay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 obinnaakaolisa/flutterwave-pay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 obinnaakaolisa/flutterwave-pay 我们能提供哪些服务?
定制开发 / 二次开发

基于 obinnaakaolisa/flutterwave-pay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-11