Package Data | |
---|---|
Maintainer Username: | angelbachev |
Maintainer Contact: | angelbachev@gmail.com (:Angel Bachev) |
Package Create Date: | 2016-02-22 |
Package Last Update: | 2022-03-21 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-24 15:01:13 |
Package Statistics | |
---|---|
Total Downloads: | 1,974 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 7 |
Total Watchers: | 2 |
Total Forks: | 10 |
Total Open Issues: | 1 |
Laravel wrapper for the Epay.bg API. Working with laravel 5.1
Via Composer
$ composer require angelbachev/epay
AngelBachev\Epay\EpayServiceProvider::class
'Epay' => AngelBachev\Epay\Facades\Epay::class
php artisan vendor:publish --provider="AngelBachev\Epay\EpayServiceProvider"
php artisan vendor:publish --tag="config"
php artisan vendor:publish
# Epay configuration values
EPAY.mode=stage # if you want to make real payments set this to prod
# Settings for testing purposes
EPAY.stage.client_id= #Add your Customer number
EPAY.stage.secret= #Add your Secret key
EPAY.stage.success_url= #URL where you want the customer to be redirected after confirming payment
EPAY.stage.cancel_url= #URL where you want the customer to be redirected if he rejects the payment
# Production settings
EPAY.prod.client_id= #Add your Customer number
EPAY.prod.secret= #Add your Secret key
EPAY.prod.success_url= #URL where you want the customer to be redirected after confirming payment
EPAY.stage.cancel_url= #URL where you want the customer to be redirected if he rejects the payment
$invoice = mt_rand(1, 1000000);
$amount = 150.63;
$expiration = '01.03.2016 08:30:00';
$description = 'Invoice Description';
Epay::setData(
$invoice, // accepts only positive integer values
$amount, // accepts only positive integers and float numbers with 1 or 2 digits after decimal point
$expiration, // accepts time in format DD.MM.YYYY[ hh:mm[:ss]]
$description, // max length 100 symbols
[$currency], // optional, accepts only "BGN", "USD", "EUR" ("BGN" by default)
[$encoding] // optional, accepts only "utf-8"
);
Route::post('receive', function() { # replace 'receive' with your real route for handling Epay notifications
$receiver = Epay::receiveNotification(Input::all());
/**
* Update order or status of payment
*
* array (
* 'invoice' => '1500',
* 'status' => 'PAID',
* 'pay_date' => '20160221143730',
* 'stan' => '036257',
* 'bcode' => '036257',
* ),
*
**/
// Do something with the response
foreach($receiver['items'] as $item) {
Log::info($item);
Log::info($item['status']);
Log::info($item['invoice']);
}
return $receiver['response'];
});
<form action="{{ Epay::getSubmitUrl() }}" method="post">
{!! Epay::generateHiddenInputs() !!}
// your code here
<button type=submit>Send</button>
</form>
This package only supports Laravel 5 & Laravel 5.1 & 5.2 at the moment.
Please see CHANGELOG for more information what has changed recently.
If you discover any security related issues, please email angelbachev@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
https://packagist.org/packages/angelbachev/epay