Epay driver for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Epay, EasyPay Bpay and more Bugarian online payment providers support for Omnipay.
Omnipay is installed via Composer. To install, simply add it
to your composer.json
file:
{
"require": {
//...
"omnipay/epay": "1.2.*@dev",
}
}
And run composer to update your dependencies:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
###The following gateways are provided by this package:
- Epay (Epay Chekcout)
- EasyPay (EasyPay check out provider)
For general usage instructions, please see the main Omnipay repository.
use Omnipay\Omnipay;
$method = Epay; # Or Easypay
$gateway = Omnipay::create($method);
$gateway->setSignature('EapyKey');
$gateway->setMin('Eapy user');
$gateway->setReturnUrl('ecample.com/{successful}'); ##retunr url after success pay
$gateway->setCancelUrl('ecample.com/{reject}'); ##return url after recject pay
//For demo pack
$gateway->setTestMode(true);
//To generate transactionId/invoce we need basic function
$invoce = substr(number_format(time() * rand(), 0, '', ''), 0, 10);
$params = $params = [
'amount' => $amount,
'transactionId' => $invoice,
'currency' => $currency,
];
$response = $gateway->purchase($params)->send();
if ($response->isSuccessful()) {
// only EasyPay get IDN
echo($response->getRedirectData());
} elseif ($response->isRedirect()) {
// redirect to epay payment gateway
$response->redirect();
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
- Listener for return payment status
//Use only epay gateway
$gateway = $gateway = Omnipay::create('epay');
$response = $gateway->capture($_POST)->send();
if ($response['invoice']) {
if (isset($response['notify_text'])) {
//This is requere to stop epay gateway sends data
//Status of pyments is $response['status'];
//
echo $response['notify_text'];
}
}
##TODO
- Add funtion for expire data
- Add function for add description
- Add for more property
If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.