sadegh-pm / saman_bank
Saman bank transaction package
v1.0
2018-02-17 20:07 UTC
Requires
- php: >=7.0.0
This package is auto-updated.
Last update: 2024-12-05 01:04:58 UTC
README
Saman bank payment package
Install
Install latest version using composer.
$ composer require sadegh-pm/saman_bank
Usage
Request payment:
<?php use SadeghPM\SamanBank\Saman; use SadeghPM\SamanBank\SamanStorageAdapterInterface; //seller ID $merchantId = 'xxxxxxxx'; //database storage adapter that implements SamanStorageAdapterInterface $myStorageAdapter = new myImplimentedStorageAdapter(); $payment = new Saman($myStorageAdapter,$merchantId); $amountInRial = 10000; //return customer after payment $callbackUrl = 'http://mysite.ir/callback'; //request payment and redirect user to saman payment page echo $payment->payRequest($amountInRial,$callbackUrl)->getRedirectScript();
Response verify:
<?php use SadeghPM\SamanBank\Saman; use SadeghPM\SamanBank\SamanStorageAdapterInterface; //seller ID $merchantId = 'xxxxxxxx'; //database storage adapter that implements SamanStorageAdapterInterface $myStorageAdapter = new myImplimentedStorageAdapter(); $payment = new Saman($myStorageAdapter,$merchantId); try{ $payment->getPayStat($_POST); echo 'Thanks...successful payment.'; }catch (\Throwable $throwable){ echo "error :".$throwable->getMessage(); }