soltanihossein / saman-payment
Saman bank payment
v1.0.0
2020-08-08 15:11 UTC
Requires
- php: ^7.1
- ext-soap: *
Requires (Dev)
- phpunit/phpunit: ^6.5.6
This package is auto-updated.
Last update: 2025-05-09 02:35:55 UTC
README
Easily integrate PHP application with saman bank payment.
Installation
$ composer require soltanihossein/saman-payment
Implementation
Attention: The Saman Bank webservice just available with IP that allowed with Saman Bank.
Request payment
<?php use SoltaniHossein\Saman\Saman; try{ /** * @param int $merchantId (required) The Saman gateway merchant id */ $saman = new Saman($merchantId); /** * @param int $amount (required) The amount that customer must pay * @param string $callbackUrl (required) The url that customer redirect to after payment * @param int $orderId (optional) The unique order id, generate by package if value passed null * @param int $additionalData (optional) addition data * * @method request Return array contain transaction `token` and you can save. * $token = $response; * */ $response = $saman->request($amount, $callbackUrl, $invoiceId); /** * Redirect user to payment gateway */ echo $saman->redirect(); }catch (\Throwable $exception){ echo $exception->getMessage(); }
Verify transaction
Customer redirect to callback url with all transaction data and you must verify transaction.
verify:
<?php use SoltaniHossein\Saman\Saman; try{ /** * @param int $merchantId (required) The Saman gateway merchant id */ $saman = new Saman($merchantId); /** * * @method $verify return array of transaction data. * */ $response = $saman->verify($amount); echo "Successful payment ..."; }catch (\Throwable $exception){ echo $exception->getMessage(); }
License
Copyright (c) 2020