yogigr/payment-gateway
Composer 安装命令:
composer require yogigr/payment-gateway
包简介
A simple and versatile Laravel package for integrating multiple payment providers. Easily manage and process payments from various gateways with a unified API.
README 文档
README
A simple and versatile Laravel package for integrating multiple payment providers. Easily manage and process payments from various gateways with a unified API.
Installation
To install the PaymentGateway package, follow these steps:
-
Require the Package via Composer
Run the following command in your Laravel project directory:
composer require yogigr/payment-gateway
-
Publish the Configuration File
Publish the configuration file using the following command:
php artisan vendor:publish --provider="yogigr\PaymentGateway\PaymentGatewayServiceProvider" --tag="config"
-
Set Up Environment Variables
your .env file:
PAYMENT_GATEWAY=duitku PAYMENT_CALLBACK_DOMAIN=https://example.app PAYMENT_RETURN_DOMAIN=https://example.app DUITKU_MERCHANT_CODE=duitku-merchant-code DUITKU_MERCHANT_KEY=duitku-merchant-key DUITKU_SANDBOX_MODE=true DUITKU_SANITIZED_MODE=false DUITKU_LOGS=true DUITKU_PAYMENT_URL=https://sandbox.duitku.com/TopUp/v2/DuitkuNotification.aspx FINPAY_MERCHANT_CODE=finpay-merchant-id FINPAY_MERCHANT_KEY=finpay-merchant-key FINPAY_PAYMENT_URL=https://devo.finnet.co.id
Usage
After installation, you can use the package via the provided Facade. Below are examples of how to fetch categories and items.
Show Payment Methods
use yogigr\PaymentGateway\Facades\PaymentGateway; $methods = PaymentGateway::getPaymentMethodOptions();
Create Invoice
use yogigr\PaymentGateway\Facades\PaymentGateway; $data = [ 'amount' => 100000, 'email' => 'customer@email.com', 'phone' => '628100000000', 'product_details' => 'Product details', 'merchant_order_id' => 'order id / kode', 'invoice_id' => 'Invoice id', 'merchant_user_info' => 'Customer info / user id', // (opsional) 'customer_name' => 'Customer name', 'callback_path' => '/payment/callback', 'return_path' => '/invoices', 'success_path' => '/invoices?status=success', 'expiry_period' => 60, 'address' => 'Customer address', 'city' => 'Customer city', 'postal_code' => 'Postal code', 'country_code' => 'ID' ]; $paymentMethod = 'credit_card'; $response = PaymentGateway::createInvoice($data, $paymentMethod); if ($response->statusCode == '00') { redirect($response->paymentUrl); }
Callback
use yogigr\PaymentGateway\Facades\PaymentGateway; use Illuminate\Http\Request; class CallbackController extends Controller { public function callback(Request $request) { $result = PaymentGateway::callback($request); if ($result['resultCode'] === '00') { // success // actions if success } } }
Check transaction
use yogigr\PaymentGateway\Facades\PaymentGateway; $transaction = PaymentGateway::checkTransaction($merchantOrderId); dd($transaction);
yogigr/payment-gateway 适用场景与选型建议
yogigr/payment-gateway 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 yogigr/payment-gateway 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yogigr/payment-gateway 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-23