seunex17/flutterwave-php-payment-gateway 问题修复 & 功能扩展

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

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

seunex17/flutterwave-php-payment-gateway

Composer 安装命令:

composer require seunex17/flutterwave-php-payment-gateway

包简介

An easy to use php package for flutterway payment gateway

README 文档

README

An easy to use php package for flutterway payment gateway The easiest way to make and accept payments from customers anywhere in the world.

Installation

Install via composer RECOMMENDED

composer require seunex17/flutterwave-php-payment-gateway

Usage

Checkout page

use Flutterwave\Transaction;

require '../vendor/autoload.php';

$rave = new Transaction('YOUR-SEC-KEY', 'YOUR-PUBLIC-KEY');

$request = [
    'tx_ref' => time(), //* A unique transaction references
    'amount' => 500, //* Amount to be charged
    'currency' => 'NGN', //* Payment currency
    'payment_options' => 'card', //* Payment options
    'redirect_url' => 'http://localhost/repo/flutterwave/example/verify.php', //* Redirect url to check payment status
    'customer' => [
        'email' => 'user@mail.com', //* Customer email
        'name' => 'Zubdev', //* Customer name,
        'phone' => '' //* Customer phone number
    ],
    'meta' => [
        //* An array of an additional information
    ],
    'customizations' => [
        'title' => 'Paying for a sample product', //* Payment title
        'description' => 'sample', //* Payment description
        'logo' => '' //* Your website logo url
    ]
];


//* Send data to Flutterwave hosted checkout page
$rave->checkout($request);

Payment Verification

use Flutterwave\Transaction;

require '../vendor/autoload.php';

$rave = new Transaction('YOUR-SEC-KEY', 'YOUR-PUBLIC-KEY');

//* Check payment status from the url get param
if (isset($_GET['status']) && isset($_GET['transaction_id']))
{
    if ($_GET['status'] == 'successful')
    {
        //* Grab the transaction id
        $txnID = $_GET['transaction_id'];

        //* Validation example
        $response = $rave->verify($txnID);
        
        if ($response->status == 'success')
        {
            //* Extracted data
            $id = $response->data->id;
            $txRef = $response->data->tx_ref;
            $flwRef = $response->data->flw_ref;
            $deviceFingerPrint = $response->data->device_fingerprint;
            $amount = $response->data->amount;
            $currency = $response->data->currency;
            $chargeAmount = $response->data->charged_amount;
            $appFee = $response->data->app_fee;
            $merchantFee = $response->data->merchant_fee;
            $processorResponse = $response->data->processor_response;
            $authModel = $response->data->auth_model;
            $ip = $response->data->ip;
            $narration = $response->data->narration;
            $status = $response->data->status;
            $paymentType = $response->data->payment_type;
            $createdAt = $response->data->created_at;
            $accountId = $response->data->account_id;

            //* Payment card information
            $firstSixDigit = $response->data->card->first_6digits;
            $lastFourDigit = $response->data->card->last_4digits;
            $issuer = $response->data->card->issuer;
            $country = $response->data->card->country;
            $cardType = $response->data->card->type;
            $cardToken = $response->data->card->token;
            $cardExpire = $response->data->country;

            //* meta
            $meta = $response->meta;

            //* Customer
            $name = $response->data->customer->name;
            $phone = $response->data->customer->phone;
            $email = $response->data->customer->phone;


            //* hint check if amount paid correct
            $productPrice = "YOUR PRODUCT PRICE FROM DATABASE";
            if($chargeAmount >= $productPrice)
            {
                //* Give item
            }
            else
            {
                //* Don't give item
            }
        }
    }

    //* Throw user to error page
}

//* Throw user to error page

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固