Download the PHP package jonhwu/laravel-unitpay without Composer
On this page you can find all versions of the php package jonhwu/laravel-unitpay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-unitpay
Laravel payment processor package for UnitPay gateway
Accept payments via UnitPay (unitpay.ru) using this Laravel framework package (Laravel).
- receive payments, adding just the two callbacks
Laravel >= 8.*, PHP >= 7.3
To use the package for Laravel 7.* use the 3.x branch
To use the package for Laravel 6.* use the 2.x branch
To use the package for Laravel 5.* use the 1.x branch
Installation
Require this package with composer.
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php
Add the UnitPay
facade to your facades array:
Copy the package config to your local config with the publish command:
Configuration
Once you have published the configuration files, please edit the config file in config/unitpay.php
.
- Create an account on unitpay.ru
- Add your project, copy the
public_key
,secret_key
params and paste intoconfig/unitpay.php
- After the configuration has been published, edit
config/unitpay.php
- Set the callback static function for
searchOrder
andpaidOrder
- Create route to your controller, and call
UnitPay::handle
method
Usage
1) Generate a payment url or get redirect:
2) Process the request from UnitPay:
Important
You must define callbacks in config/unitpay.php
to search the order and save the paid order.
Example
The process scheme:
- The request comes from
unitpay.ru
GET
http://yourproject.com/unitpay/result
(with params). - The function
UnitPayController@handlePayment
runs the validation process (auto-validation request params). - The method
searchOrder
will be called (seeconfig/unitpay.php
searchOrder
) to search the order by the unique id. - If the current order status is NOT
paid
in your database, the methodpaidOrder
will be called (seeconfig/unitpay.php
paidOrder
).
Add the route to routes/web.php
:
Note: don't forget to save your full route url (e.g. http://example.com/unitpay/result ) for your project on unitpay.ru.
Create the following controller: /app/Http/Controllers/UnitPayController.php
:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please send me an email at [email protected] instead of using the issue tracker.
Credits
- JonhWu
- All Contributors
License
The MIT License (MIT). Please see License File for more information.