nikajorjika/bog-payment
Composer 安装命令:
composer require nikajorjika/bog-payment
包简介
This is my package bog-payment
关键字:
README 文档
README
⚠️ Deprecation Warning
This package is deprecated and will no longer receive updates, bug fixes, or security patches.
🔄 Recommended Alternatives
The package has been moved to a new vendor. To continue receiving updates, please switch to the new package.
- RedberryProducts/laravel-bog-payment – Maintained and actively supported.
❓ What This Means
- No new features will be added.
- No bug fixes or security patches will be provided.
- No support for future Laravel versions.
- The repository may be archived in the near future.
🚀 Migration Guide
- In composer.json, replace
"nikajorjika/bog-payment": "^1.0"with"redberryproducts/laravel-bog-payment": "^1.0" - Run
composer update - Replace
Jorjika\BogPayment\Facades\PaywithRedberryProducts\LaravelBogPayment\Facades\Pay - Replace
Jorjika\BogPayment\Facades\TransactionwithRedberryProducts\LaravelBogPayment\Facades\Transaction - In your Listener, replace
Nikajorjika\BogPayment\Events\TransactionStatusUpdatedwithRedberryProducts\LaravelBogPayment\Events\TransactionStatusUpdated
❤️ Thank You
BOG Payment Gateway
The BOG Payment package provides seamless integration with the Bank of Georgia's payment gateway, enabling Laravel applications to process payments efficiently.
Demo
You can find a demo project here
Features
- Payment Processing: Initiate and manage transactions through the Bank of Georgia.
- Transaction Status: Retrieve and handle the status of payments.
- Secure Communication: Ensure secure data transmission with the payment gateway.
Installation
You can install the package via composer:
composer require nikajorjika/bog-payment
You can publish the config file with:
php artisan vendor:publish --tag="bog-payment-config"
Once published, the configuration file will be available at:
config/bog-payment.php
Environment Variables
Add the following variables to your .env file to configure the package:
BOG_SECRET=[your_client_secret] BOG_CLIENT_ID=[your_client_id] BOG_PUBLIC_KEY=[your_public_key] # Can be found at https://api.bog.ge/docs/payments/standard-process/callback
You can find up to date BOG_PUBLIC_KEY in the Bank of Georgia's API documentation.
You can also configure additional environment variables as needed. But this is the minimum that you need to implement.
Usage
Usage Example: Simple Payment Processing
To initiate a payment, use the Pay facade to set the order details and process the transaction:
use Jorjika\BogPayment\Facades\Pay; use App\Models\Transaction; // Step 1: Create a transaction record $transaction = Transaction::create([ 'user_id' => auth()->id(), 'amount' => $data['total_amount'], 'status' => 'pending', // Initial status ]); // Step 2: Process the payment $paymentDetails = Pay::orderId($transaction->id) ->redirectUrl(route('bog.v1.transaction.status', ['transaction_id' => $transaction->id])) ->amount($transaction->amount) ->process(); // Step 3: Update the transaction with payment details $transaction->update([ 'transaction_id' => $paymentDetails['id'], ]); // Step 4: Redirect user to the payment gateway return redirect($paymentDetails['redirect_url']);
here's an example of the response:
$paymentDetails = [ 'id' => 'test-id', 'redirect_url' => 'https://example.com/redirect', 'details_url' => 'https://example.com/details', ]
Save Card During Payment
To save the card during the payment process, you can use the saveCard() method. This method will save the card details for future transactions.
When you want to save card during the payment, you need to do the following:
use Jorjika\BogPayment\Facades\Pay; // SaveCard method will initiate another request that notifies bank to save card details $response = Pay::orderId($external_order_id)->amount($amount)->saveCard()->process(); // Example response $response = [ 'id' => 'test-id', 'redirect_url' => 'https://example.com/redirect', 'details_url' => 'https://example.com/details', ];
When you receive the response, you can save the card details in your database, where id is the saved card(parent transaction) id that you would use for later transactions.
Payment with Saved Card
Once you have saved new payment method id in your database, you can initiate payments on saved cards like so:
use Jorjika\BogPayment\Facades\Card; $response = Card::orderId($external_order_id)->amount($amount)->charge("test-id"); // Example response $response = [ 'id' => 'test-id', 'redirect_url' => 'https://example.com/redirect', 'details_url' => 'https://example.com/details', ];
Functionality above will charge saved card without the user interaction.
Building the payload
Although the package provides a convenient way to initiate payments, you can also build the payment payload manually using the provided traits.
The BuildsPayment trait helps you build the payload for payments quickly by providing the following methods
Here's how you do it:
getPayload(): // Retrieves the current payload array. orderId($externalOrderId): // Sets the external order ID for the payment. callbackUrl($callbackUrl): // Sets a custom callback URL for the payment process. redirectUrl($statusUrl): // Sets both success and fail URLs to the same value for redirection after the payment. redirectUrls($failUrl, $successUrl): // Sets separate fail and success URLs for redirection after the payment. saveCard(): // Sets the save card flag to true for the payment. amount($totalAmount, $currency = 'GEL', $basket = []): // Defines the total amount, currency, and optionally, the basket details for the payment. // These methods allow for easy customization of the payment payload to suit various payment requirements.
Set Buyer
You can set the buyer details for the payment by using the setBuyer() method. This method accepts an array of buyer details, including the buyer's full_name, masked_email, and masked_phone.
here's the example of how you can set the buyer details:
use Jorjika\BogPayment\Facades\Pay; $buyer = [ 'full_name' => 'John Doe', 'masked_email' => 'john**@gmail.com', 'masked_phone' => '59512****10', ]; $paymentDetails = Pay::orderId($transaction->id) ->redirectUrl(route('bog.v1.transaction.status', ['transaction_id' => $transaction->id])) ->amount($data['total_amount']) ->buyer($buyer) // Set new buyer details ->process(); // Optionally you can set buyer details separately $paymentDetails = Pay::orderId($transaction->id) ->redirectUrl(route('bog.v1.transaction.status', ['transaction_id' => $transaction->id])) ->amount($data['total_amount']) ->buyerName($buyer['full_name']) // Set new buyer full name ->buyerEmail($buyer['masked_email']) // Set new buyer masked email ->buyerPhone($buyer['masked_phone']) // Set new buyer masked phone ->process();
Callback Handling
The package handles callback behavior automatically. When a payment is processed, it will send a POST request to your callback URL with the payment details. The package then verifies the request's signature to ensure its authenticity and fires the Nikajorjika\BogPayment\Events\TransactionStatusUpdated event, which contains all relevant payment details.
To utilize this functionality, register an event listener in your application to capture and respond to the transaction status updates as needed.
Example: Registering a Listener for Transaction Status Updates Add the following code to your event listener:
namespace App\Listeners; use Nikajorjika\BogPayment\Events\TransactionStatusUpdated; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; class HandleTransactionStatusUpdate implements ShouldQueue { use InteractsWithQueue; /** * Handle the event. * * @param \Nikajorjika\BogPayment\Events\TransactionStatusUpdated $event * @return void */ public function handle(array $event) { // Implement your logic here }
Setting Up the Event Listener
Setting Up the Event Listener To handle transaction status updates efficiently, you need to register an event listener that listens for the TransactionStatusUpdated event triggered by the package.
- Generating the Listener Automatically
You can generate the event listener using the Artisan command:
php artisan make:listener HandleTransactionStatusUpdate --event=\Nikajorjika\BogPayment\Events\TransactionStatusUpdated
This command will create a listener class atapp/Listeners/HandleTransactionStatusUpdate.php, which you can customize to handle the event logic.
This approach provides flexibility by allowing dynamic event registrations at runtime without modifying the EventServiceProvider.
For more details on event handling in Laravel, refer to the official documentation.
Handling Transaction Status
The package provides a convenient way to retrieve the status of a transaction using the Transaction Facade's get() method. This method sends a GET request to the Bank of Georgia payment API to retrieve the transaction status.
Here's how you can use it:
use Jorjika\BogPayment\Facades\Transaction; $transactionDetails = Transaction::get($order_id); // Returns array of transaction details
See example of the response Official Documentation
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
nikajorjika/bog-payment 适用场景与选型建议
nikajorjika/bog-payment 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 36 次下载、GitHub Stars 达 5, 最近一次更新时间为 2024 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「Jorjika」 「bog-payment」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nikajorjika/bog-payment 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nikajorjika/bog-payment 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nikajorjika/bog-payment 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This is my package bog-payment
Alfabank REST API integration
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
Boot a Laravel project on any machine with one command: app:serve installs missing tools (PHP, Node, Composer, Herd, Docker), creates .env, sets up the database, runs migrations, builds assets, starts a queue worker and serves via Herd, Sail or artisan serve; app:down cleanly stops everything it sta
Branded, diagnostic error pages (500, 403, 404, 419, 503) for Filament — native Filament UI, dark mode and translations out of the box.
统计信息
- 总下载量: 36
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-07