Download the PHP package redberryproducts/laravel-bog-payment without Composer
On this page you can find all versions of the php package redberryproducts/laravel-bog-payment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download redberryproducts/laravel-bog-payment
More information about redberryproducts/laravel-bog-payment
Files in redberryproducts/laravel-bog-payment
Package laravel-bog-payment
Short Description This is my package bog-payment
License MIT
Homepage https://github.com/RedberryProducts/laravel-bog-payment
Informations about the package laravel-bog-payment
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:
You can publish the config file with:
Once published, the configuration file will be available at:
Environment Variables
Add the following variables to your .env
file to configure the package:
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:
here's an example of the response:
Save Card
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:
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.
Pay using saved card
Once you have saved new payment method id in your database, you can initiate payments on saved cards like so:
Functionality above will charge saved card without the user interaction.
Subscriptions
To register a subscription payment, you can use the Pay
facade to set the order details and process the transaction:
This will charge the saved subscription 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:
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:
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 RedberryProducts\LaravelBogPayment\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:
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:
This command will create a listener class at
app/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:
See example of the response Official Documentation
Testing
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
- Nika Jorjoliani
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-bog-payment with dependencies
guzzlehttp/guzzle Version ^7.9
illuminate/contracts Version ^10.0 || ^11.0
spatie/laravel-package-tools Version ^1.16