Mellat bank transaction library based on php soap extension.
You can install the package via composer:
composer require dpsoft/mellat
1- Request transaction and redirect to bank:
try{
$mellat = new \Dpsoft\Mellat\Mellat($terminalId, $userName, $userPassword);
$response = $mellat->request($amount);
//save $response info like token($response['token']) and orderId($response['order_id']) then redirect to bank
echo "redirecting to bank...";
$response->redirectToBank();
}catch(\Throwable $e){
echo "error: ".$e->getMessage();
}
2- Handle bank response:
try{
$mellat = new \Dpsoft\Mellat\Mellat($terminalId, $userName, $userPassword);
$response = $mellat->verify();
//successful payment. save $response info like reference id($response['reference_id'])
echo "successful payment.Thanks...";
}catch(\Throwable $e){
echo "error: ".$e->getMessage();
}
composer test
If you discover any security related issues, please email sadeghpm@gmail.com instead of using the issue tracker.
The GNU GPLv3. Please see License File for more information.