dpsoft/mellat

Mellat bank online payment - درگاه پرداخت بانک ملت به زبان PHP

v1.1 2022-07-22 20:55 UTC

This package is auto-updated.

Last update: 2024-10-23 01:40:07 UTC


README

Latest Version on Packagist Total Downloads

Mellat bank transaction library based on php soap extension.

Installation

You can install the package via composer:

composer require dpsoft/mellat

Usage

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();
}

Testing

composer test

Security

If you discover any security related issues, please email sadeghpm@gmail.com instead of using the issue tracker.

Credits

License

The GNU GPLv3. Please see License File for more information.