aries / gateway
A Laravel package for connecting to all Iraninan payment gateways
Requires
- aries/laravelsetting: *
- nesbot/carbon: ~1.20
This package is auto-updated.
Last update: 2024-11-29 05:21:01 UTC
README
by this package we are able to connect to all Iranian bank with one unique API.
Please inform us once you've encountered bug or issue .
Available Banks:
- MELLAT
- SADAD (MELLI)
- SAMAN
- PARSIAN
- PASARGAD
- ZARINPAL
JAHANPAY(Disabled)PAYLINE(Disabled)
Installation:
Run below statements on your terminal :
STEP 1 :
composer require aries/gateway
STEP 2 : Add provider
and facade
in config/app.php
'providers' => [
...
Aries\Gateway\GatewayServiceProvider::class, // <-- add this line at the end of provider array
],
'aliases' => [
...
'Gateway' => Aries\Gateway\Gateway::class, // <-- add this line at the end of aliases array
]
Step 3:
php artisan vendor:publish --provider=Aries\Gateway\GatewayServiceProvider
Step 4:
php artisan migrate
Important
You need add Aries/LaravelSetting's ServiceProvider and Facade to config/app.php
file
Usage
You can make connection to bank by several way (Facade , Service container):
try {
$gateway = \Gateway::make(new \Mellat());
// $gateway->setCallback(url('/path/to/calback/route')); You can also change the callback
$gateway->price(1000)->ready();
$refId = $gateway->refId();
$transID = $gateway->transactionId();
// Your code here
return $gateway->redirect();
} catch (Exception $e) {
echo $e->getMessage();
}
you can call the gateway by these ways :
- Gateway::make(new Mellat());
- Gateway::mellat()
- app('gateway')->make(new Mellat());
- app('gateway')->mellat();
Instead of MELLAT you can enter other banks Name as we introduced above .
In price
method you should enter the price in IRR (RIAL)
and in your callback :
try {
$gateway = \Gateway::verify();
$trackingCode = $gateway->trackingCode();
$refId = $gateway->refId();
$cardNumber = $gateway->cardNumber();
// Your code here
} catch (Exception $e) {
echo $e->getMessage();
}
If you are intrested to developing this package you can help us by these ways :
- Improving documents.
- Reporting issue or bugs.
- Collaboration in writing codes and other banks modules.
This package is extended from PoolPort but we've changed some functionality and improved it .
a fork from larabook/gateway