tomatophp/filament-payments 问题修复 & 功能扩展

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

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

tomatophp/filament-payments

Composer 安装命令:

composer require tomatophp/filament-payments

包简介

Manage your payments inside FilamentPHP app with multi payment gateway integration

README 文档

README

Screenshot

Filament Payment Manager

Latest Stable Version License Downloads

Manage your payments inside FilamentPHP app with multi payment gateway integration

Screenshots

Payment Page Payments View Payment Payment Gates Edit Gate Gate Option Payment Action Payment Action Confirm

Features

  • Payments List
  • Payment View
  • Payment Filter And Groups by Status
  • Payment Gates
  • Payment Gate Options
  • Payment Action
  • Payment Facade Method
  • Payment Page
  • Payment Drivers
  • StripeV3 Integration
  • Plisio Integration
  • Paypal Integration
  • Paymob Integration
  • Tap Integration
  • Myfatoorah Integration
  • Creptomus Integration
  • Paddle Integration
  • Lemon Squeezy Integration
  • Binance Integration
  • PayTabs Integration
  • Moyaser Integration
  • Payfort Integration
  • Fawery Integration

Installation

composer require tomatophp/filament-payments

we need the Media Library plugin to be installed and migrated you can use this command to publish the migration

php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"

after install your package please run this command

php artisan filament-payments:install

finally register the plugin on /app/Providers/Filament/AdminPanelProvider.php

->plugin(\TomatoPHP\FilamentPayments\FilamentPaymentsPlugin::make())

Using

you can use payment with the very easy way just use Facade FilamentPayments like this

use TomatoPHP\FilamentPayments\Facades\FilamentPayments;
use TomatoPHP\FilamentPayments\Services\Contracts\PaymentBillingInfo;
use TomatoPHP\FilamentPayments\Services\Contracts\PaymentCustomer;
use TomatoPHP\FilamentPayments\Services\Contracts\PaymentRequest;
use TomatoPHP\FilamentPayments\Services\Contracts\PaymentShippingInfo;
use TomatoPHP\FilamentSubscriptions\Facades\FilamentSubscriptions;

return redirect()->to(
        FilamentPayments::pay(
            data: PaymentRequest::make(Plan::class)
                ->model_id($data['new']->id)
                ->currency('USD')
                ->amount($data['new']->price)
                ->details('Subscription Payment')
                ->success_url(url('/success'))
                ->cancel_url(url('/cancel'))
                ->customer(
                    PaymentCustomer::make('John Doe')
                        ->email('john@gmail.com')
                        ->mobile('+201207860084')
                )
                ->billing_info(
                    PaymentBillingInfo::make('123 Main St')
                        ->area('Downtown')
                        ->city('Cairo')
                        ->state('Cairo')
                        ->postcode('12345')
                        ->country('EG')
                )
                ->shipping_info(
                    PaymentShippingInfo::make('123 Main St')
                        ->area('Downtown')
                        ->city('Cairo')
                        ->state('Cairo')
                        ->postcode('12345')
                        ->country('EG'
                        )
                )),
    );

if you want to return it as json you can just make json: true, this method return a URL for you with the payment, you can share this link with anyone to make the payment done.

Use Payment Action

you can use a Table Action to make it easy to link Payment with your table like this

use TomatoPHP\FilamentPayments\Filament\Actions\PaymentAction;

public function table(Table $table): $table
{
    return $table
        ->actions([
             PaymentAction::make('payment')
                ->request(function ($record){
                    return PaymentRequest::make(Order::class)
                        ->model_id($record->id)
                        ->currency('USD')
                        ->amount($record->total)
                        ->details($record->ordersItems()->pluck('product_id')->implode(', '))
                        ->success_url(url('/success'))
                        ->cancel_url(url('/cancel'))
                        ->customer(
                            PaymentCustomer::make($record->name)
                                ->email($record->account->email)
                                ->mobile($record->phone)
                        )
                        ->billing_info(
                            PaymentBillingInfo::make($record->address)
                                ->area($record->area->name)
                                ->city($record->city->name)
                                ->state($record->city->name)
                                ->postcode('12345')
                                ->country($record->country->iso3)
                        )
                        ->shipping_info(
                            PaymentShippingInfo::make($record->address)
                                ->area($record->area->name)
                                ->city($record->city->name)
                                ->state($record->city->name)
                                ->postcode('12345')
                                ->country($record->country->iso3)
                        );
                })
                ->pay(),
        ]);
}

Integrate With Filament Subscription

if you like to use this package with Filament Subscription you can use this code

use TomatoPHP\FilamentPayments\Facades\FilamentPayments;
use TomatoPHP\FilamentPayments\Services\Contracts\PaymentBillingInfo;
use TomatoPHP\FilamentPayments\Services\Contracts\PaymentCustomer;
use TomatoPHP\FilamentPayments\Services\Contracts\PaymentRequest;
use TomatoPHP\FilamentPayments\Services\Contracts\PaymentShippingInfo;
use TomatoPHP\FilamentSubscriptions\Facades\FilamentSubscriptions;

public function boot(): void
    {
        FilamentSubscriptions::afterSubscription(function ($data) {
            //Payment Here
            return redirect()->to(FilamentPayments::pay(
                data: PaymentRequest::make(Plan::class)
                    ->model_id($data['new']->id)
                    ->currency('USD')
                    ->amount($data['new']->price)
                    ->details('Subscription Payment')
                    ->success_url(url('/success'))
                    ->cancel_url(url('/cancel'))
                    ->customer(
                        PaymentCustomer::make('John Doe')
                            ->email('john@gmail.com')
                            ->mobile('+201207860084')
                    )
                    ->billing_info(
                        PaymentBillingInfo::make('123 Main St')
                            ->area('Downtown')
                            ->city('Cairo')
                            ->state('Cairo')
                            ->postcode('12345')
                            ->country('EG')
                    )
                    ->shipping_info(
                        PaymentShippingInfo::make('123 Main St')
                            ->area('Downtown')
                            ->city('Cairo')
                            ->state('Cairo')
                            ->postcode('12345')
                            ->country('EG')
                    )
            ));
        });
    }

it will redirect you to payment after the hook is called.

Publish Assets

you can publish config file by use this command

php artisan vendor:publish --tag="filament-payments-config"

you can publish views file by use this command

php artisan vendor:publish --tag="filament-payments-views"

you can publish languages file by use this command

php artisan vendor:publish --tag="filament-payments-lang"

you can publish migrations file by use this command

php artisan vendor:publish --tag="filament-payments-migrations"

Other Filament Packages

Checkout our Awesome TomatoPHP

tomatophp/filament-payments 适用场景与选型建议

tomatophp/filament-payments 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.45k 次下载、GitHub Stars 达 54, 最近一次更新时间为 2024 年 08 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「payments」 「paypal」 「stripe」 「laravel」 「cacher」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 tomatophp/filament-payments 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 54
  • Watchers: 2
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-20