lee-to / laravel-cashbox
Laravel cashbox module
0.2.3
2022-02-16 16:40 UTC
Requires
- php: ^7.3|^8.0
- kassacom/php-sdk: dev-master
- telegram-bot/api: ^2.3
- yoomoney/yookassa-sdk-php: ^2.0
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: 8.5.x-dev
README
Install
-
composer require lee-to/laravel-cashbox
-
php artisan vendor:publish --provider="Leeto\CashBox\Providers\CashBoxServiceProvider"
-
php artisan cashbox:install
-
configure config/cashbox.php
Available payment gateways
- YooKassa (config/cashbox.php credentials - id(shopId), key(shopPassword))
- KassaCom (config/cashbox.php credentials - login, secret, key(api-key))
Usage
Create payment url
app("payment")->setPaymentDescription("Premium"); app("payment")->setReturnUrl(route("home")); app("payment")->setAmount(100); app("payment")->setParams([ "user_id" => auth()->id(), ]); return redirect(app("payment")->createPayment());
Capture payment
return response()->json(app("payment")->capturePayment(function ($paymentParams, $paymentToken, $bankCard) { }));
Tests
- vendor/bin/phpunit tests