masterzero/epay is a Laravel package for library for working with epay payment system via api.
It currently has 0 GitHub stars and 1.261 downloads on Packagist.
Install it with composer require masterzero/epay.
Discover more Laravel packages by masterzero
or browse all Laravel packages to compare alternatives.
Last updated
library to work with ePay payment system via API.
Use following command in your terminal to install this library. (Currently the library is in development mode):
composer require masterzero/epay dev-master
Update the poviders in config/app.php
'providers' => [
// ...
MasterZero\Epay\ApiServiceProvider::class,
]
Update the aliases in config/app.php
'aliases' => [
// ...
'EpayApi' => MasterZero\Epay\Facade\Api::class,
]
Create config/epay.php with content:
return [
'merchantnumber'=> env('EPAY_MERCHANTNUMBER', '1337'),
'password'=> env('EPAY_PASSWORD', '12345678'),
];
.env (optional):
EPAY_MERCHANTNUMBER=1337
EPAY_PASSWORD=12345678
capture transaction. Customer money -> your money
use EpayApi;
// ...
$optionalParams = [
'group' => 'customers',
'invoice' => 'for some product',
]
$result = EpayApi::capture($transactionid, $amount /*, $optionalParams*/);
if ($result['captureResult']) {
echo "ba dum tss! the method works!";
} else {
echo "nope. something went wrong :C";
}
Credit transaction. Part of captured (your) money -> back to customer money
use EpayApi;
// ...
$optionalParams = [
'group' => 'customers',
'invoice' => 'for some product',
]
$result = EpayApi::credit($transactionid, $amount /*, $optionalParams*/);
if ($result['creditResult']) {
echo "ba dum tss! the method works!";
} else {
echo "nope. something went wrong :C";
}
Delete transaction. All of non-captured (not-your) money -> back to customer money
use EpayApi;
// ...
$optionalParams = [
'group' => 'customers',
]
$result = EpayApi::delete($transactionid /*, $optionalParams*/);
if ($result['deleteResult']) {
echo "ba dum tss! the method works!";
} else {
echo "nope. something went wrong :C";
}
Get money for payment subscription
use EpayApi;
// ...
$params = [
'subscriptionid' => 123,
'orderid' => 123,
'amount' => 5000, // 50.00 * 100
'currency' => 208, // DKK
'instantcapture' => 1,
'group' => 'customer', //optional
'description' => 'la la la', //optional
'email' => '[email protected]', //optional
'sms' => 'la la la', //optional
'ipaddress' => '255.255.255.255', //optional
]
$result = EpayApi::authorize($params);
if ($result['authorizeResult']) {
echo "ba dum tss! the method works!";
} else {
echo "nope. something went wrong :C";
}
Delete subscription and stop authorize.
use EpayApi;
// ...
$result = EpayApi::deletesubscription($subscriptionid);
if ($result['deletesubscriptionResult']) {
echo "ba dum tss! the method works!";
} else {
echo "nope. something went wrong :C";
}
Get epay error description by epayresponsecode
use EpayApi;
// ...
/**
* laguages:
* 1 - Danish
* 2 - English
* 3 - Swedish
*/
$result = EpayApi::getEpayError($language, $epayresponsecode);
if ($result['getEpayErrorResult']) {
echo "ba dum tss! the method works!";
} else {
echo "nope. something went wrong :C";
}
Get pbs error description by pbsresponsecode
use EpayApi;
// ...
/**
* laguages:
* 1 - Danish
* 2 - English
* 3 - Swedish
*/
$result = EpayApi::getPbsError($language, $pbsresponsecode);
if ($result['getPbsErrorResult']) {
echo "ba dum tss! the method works!";
} else {
echo "nope. something went wrong :C";
}
use MasterZero\Epay\Api;
// ...
$api = new Api([
'merchantnumber' => '1337',
'password' => '12345678',
]);
$api->authorize($params);