dpsoft / zibal
Zibal online payment - درگاه پرداخت آسان پرداخت به زبان PHP
v2.0
2021-12-05 05:46 UTC
Requires
- php: ^7.1 || ^8.0
- ext-json: *
- rmccue/requests: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-05 12:10:51 UTC
README
Installation
You can install the package via composer:
composer require dpsoft/zibal
Usage
copy sample
directory to server. Open request.php
in browser and bala balah ...
Request
try { $zibal = new \Dpsoft\Zibal\Zibal($merchant); $result = $zibal->request($callbackUrl,$amount); //save amount and invoice id to forther use $_SESSION['amount']=$amount; $_SESSION['token']=$result['token']; $zibal->redirectToBank(); exit(); }catch (Throwable $exception){ echo $exception->getMessage(); }
Response
try { $zibal = new \Dpsoft\Zibal\Zibal($merchant); $result = $zibal->verify($_SESSION['amount'],$_SESSION['token']); //save result. The keys are: card_number,transaction_id and token for example $result['token'] echo "Successfull transaction."; }catch (Throwable $exception){ echo "Error in transaction: "; }
Testing
composer test
Security
If you discover any security related issues, please email info@dpsoft.ir instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.