esijafari2012/parsian-pay

Iranian parsian bank payment gateways handler for laravel based applications

1.0.5 2022-09-28 13:57 UTC

This package is auto-updated.

Last update: 2022-09-28 14:00:49 UTC


README

Easily integrate PHP application with parsian bank payment.

Installation

$ composer require esijafari2012/parsian-pay

Example Usage

Example For Pay

use Esijafari2012\ParsianPay\Pay;
use Esijafari2012\ParsianPay\Entities\PeyResult;

$pIPG=new Pay('scsdsdfbdsthsgfnfgndg');//set parsian pin
$OrderId = (float)(time() . rand(000,999)); // factor number
$Amount  = 1000; // amount to pay
$CallbackUrl='http://example.ir/callback' ; // set callback url
$pr=$pIPG->payment($OrderId,$Amount,$CallbackUrl);
if($pr instanceof PeyResult){
    if(($pr->getStatus()==0)&&($pr->getToken()>0)){
        $pIPG->redirect();// redirect to parsian bank gateway  for payment  
    }
}

Example For Callback

use Esijafari2012\ParsianPay\Callback;
use Esijafari2012\ParsianPay\Entities\ConfirmResult;
  
$pIPG=new Callback('scsdsdfbdsthsgfnfgndg');//set parsian pin
$cr = $pIPG->confirm();
if($cr instanceof ConfirmResult){
    if($cr->getStatus() == 0){
        die(' Payment OK ');
    }
}
echo $cr->getMessage();

Example For reverse

use Esijafari2012\ParsianPay\Reverse;
use Esijafari2012\ParsianPay\Entities\PeyResult;

$pIPG=new Reverse('scsdsdfbdsthsgfnfgndg');//set parsian pin
$pr = $pIPG->reverse(12545485);//reverse token payment
 
if($pr instanceof PeyResult){
    if($pr->getStatus()==0){
        die(' Reverse Payment OK ');
    }
}

echo $pr->getMessage();