定制 ajadipaul/laravel-payment-hub 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ajadipaul/laravel-payment-hub

最新稳定版本:v1.0.0

Composer 安装命令:

composer require ajadipaul/laravel-payment-hub

包简介

A comprehensive and versatile package designed to integrate multiple payment gateways into your Laravel application. This package supports a wide array of popular payment options. With Laravel Payment Hub, you can seamlessly handle payments, ensuring a smooth and unified experience for both develope

README 文档

README

Latest Version on Packagist Total Downloads GitHub Actions

A comprehensive and versatile package designed to integrate multiple payment gateways into your Laravel application. This package supports a wide array of popular payment options. With Laravel Payment Hub, you can seamlessly handle payments, ensuring a smooth and unified experience for both developers and users. The package offers a standardized interface for all supported gateways, simplifying the process of switching between different payment providers without altering your codebase significantly. Enhance your Laravel application's payment capabilities with ease and flexibility using Laravel Payment Hub.

Installation

You can install the package via composer:

composer require ajadipaul/laravel-payment-hub

Usage

//  API keys to the .env file

PAYSTACK_PUBLIC_KEY=your_paystack_public_key
PAYSTACK_SECRET_KEY=your_paystack_secret_key
FLUTTERWAVE_PUBLIC_KEY=your_flutterwave_public_key
FLUTTERWAVE_SECRET_KEY=your_flutterwave_secret_key

// Publish the configuration file to your application
php artisan vendor:publish --provider="Ajadipaul\LaravelPaymentHub\LaravelPaymentHubServiceProvider"

// Application Code Usage

class PaymentController extends Controller
{
    protected $paystack;
    protected $flutterwave;

    public function __construct()
    {
        $paystackConfig = config('paymenthub.paystack');
        $flutterwaveConfig = config('paymenthub.flutterwave');

        $this->paystack = new PaystackService();
        $this->paystack->initialize($paystackConfig);

        $this->flutterwave = new FlutterwaveService();
        $this->flutterwave->initialize($flutterwaveConfig);
    }

    public function chargeWithPaystack()
    {
        $data = [
            'amount' => 5000, // Amount in Naira
            'email' => 'user@example.com',
            'callback_url' => route('payment.callback'),
        ];

        $response = $this->paystack->charge($data);

        if ($response['status'] === 'success') {
            return redirect($response['authorization_url']);
        }

        return redirect()->back()->withErrors($response['message']);
    }

    public function chargeWithFlutterwave()
    {
        $data = [
            'amount' => 5000, // Amount in Naira
            'currency' => 'NGN',
            'email' => 'user@example.com',
            'callback_url' => route('payment.callback'),
        ];

        $response = $this->flutterwave->charge($data);

        if ($response['status'] === 'success') {
            return redirect($response['link']);
        }

        return redirect()->back()->withErrors($response['message']);
    }

    public function verifyTransaction($transactionId)
    {
        $response = $this->paystack->verify($transactionId);

        if ($response['status'] === 'success') {
            // Handle successful verification, e.g., updating order status
        } else {
            // Handle verification failure
        }
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email ajadi.ololade@gmail.com instead of using the issue tracker.

Credits

License

The GNU AGPLv. Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GNU
  • 更新时间: 2024-08-31