xahmedtaha/paybridge 问题修复 & 功能扩展

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

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

xahmedtaha/paybridge

最新稳定版本:v0.1.3

Composer 安装命令:

composer require xahmedtaha/paybridge

包简介

A versatile laravel package providing a consistent and easy-to-use interface for integrating with multiple payment gateways.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

A versatile laravel package providing a consistent and easy-to-use interface for integrating with multiple payment gateways.

Installation

You can install the package via composer:

composer require xahmedtaha/paybridge

You can publish the config file with:

php artisan vendor:publish --tag="paybridge-config"

Usage

You should typically use the package as follows:

use AhmedTaha\PayBridge\Data\ChargeData;
use AhmedTaha\PayBridge\Data\CustomerData;
use AhmedTaha\PayBridge\Data\Payment\CreditCardData;
use AhmedTaha\PayBridge\Enums\PaymentEnvironment;
use AhmedTaha\PayBridge\Enums\PaymentGateway;

$charge = new ChargeData('charge ID', 200, 'USD');
$customer = new CustomerData('customer ID', 'Ahmed', 'phone', 'email@test.com');
$paymentData = new CreditCardData('1234 1234 1234 1234', '24', '05', '123');

$result = PayBridge::setEnvironment(PaymentEnvironment::TESTING)
    ->gateway(PaymentGateway::FawryPay)
    ->pay($charge, $customer, $paymentData);

// $result = [
//  'success' => true,
//  'status' => PaymentStatus::PENDING,
//  'shouldRedirect' => true,
//  'redirectUrl' => 'fawry gateway url...',
//];

A callback url should be defined in the config files. Here is how the code for this route should typically be:

use PayBridge;
use AhmedTaha\PayBridge\Enums\PaymentGateway;
use AhmedTaha\PayBridge\Enums\PaymentEnvironment;
use Illuminate\Http\Request;

public function callbackRouteHandler(Request $request) {
    $result = PayBridge::setEnvironment(PaymentEnvironment::TESTING)
    ->gateway(PaymentGateway::FawryPay)
    ->callback($request);
    // Your additional app logic...
}

// $result = [
//  'success' => true,
//  'status' => PaymentStatus::PAID,
//  'charge' => ChargeData object,
//  'customer' => CustomerData object,
//  'referenceNumber' => 'fawry ref no',
//];

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-14