PHP code example of jsoltani / parsian-bank
1. Go to this page and download the library: Download jsoltani/parsian-bank library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jsoltani / parsian-bank example snippets
php composer.phar
\src\jsBankParsian::setParsianPin('scsdsdfbdsthsgfnfgndg'); //set parsian pin
\src\jsBankParsian::setCallBackUrl('http://example.ir/callback'); // set callback url
$OrderId = time() . rand(000,999); // factor number
$Amount = 1000; // amount to pay
$getPay = \src\jsBankParsian::pay($OrderId, $Amount);
$getPay = json_decode($getPay);
$Code = $getPay->responseCode ?? -1;
$Message = $getPay->responseMessage ?? 'Error';
if($Code == 0){
$Token = $getPay->responseItems->Token ?? '';
if(!empty($Token)){
header('LOCATION: https://pec.shaparak.ir/NewIPG/?Token=' . $Token);
exit;
}
}
echo "<h2>Error : </h2><span>$Message</span>";