Wallogit.com
2017 © Pedro Peláez
library for working with ePay payment system via API
library to work with ePay payment system via API., (*1)
Use following command in your terminal to install this library. (Currently the library is in development mode):, (*2)
composer require masterzero/epay dev-master, (*3)
Update the poviders in config/app.php, (*4)
'providers' => [
// ...
MasterZero\Epay\ApiServiceProvider::class,
]
Update the aliases in config/app.php, (*5)
'aliases' => [
// ...
'EpayApi' => MasterZero\Epay\Facade\Api::class,
]
Create config/epay.php with content:, (*6)
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, (*7)
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, (*8)
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, (*9)
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, (*10)
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' => 'test@example.com', //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., (*11)
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, (*12)
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, (*13)
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);