Skip to content

Saman bank payment / پرداخت بانک سامان

License

Notifications You must be signed in to change notification settings

SadeghPM/SamanBank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SamanBank

License: GPL v2

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

About

Saman bank payment / پرداخت بانک سامان

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages