<?php


$a_chid = $_GET["chid"];
$a_am = $_GET["am"];


$MerchantID = 'ea1e96f2-3fbe-11e6-b6c1-000c295eb8fc'; //Required

$Amount = $a_am;


$Description = 'ارتقای ربات'; // Required
$Email = ''; // Optional
$Mobile = ''; // Optional

$CallbackURL = "https://teleaccmanager.telegramtools.io/dev/ideastory/finishpaying.php?chid=$a_chid&am=" . $Amount; // Required

$zara["encoding"] = "UTF-8";


$client = new SoapClient('https://www.zarinpal.com/pg/services/WebGate/wsdl', $zara);



$zara2["MerchantID"] = "$MerchantID";
$zara2["Amount"] = "$Amount";
$zara2["Description"] = "$Description";
$zara2["Email"] = "$Email";
$zara2["Mobile"] = "$Mobile";
$zara2["CallbackURL"] = "$CallbackURL";



$result = $client->PaymentRequest($zara2);

//Redirect to URL You can do it also by creating a form
if ($result->Status == 100) {
    Header('Location: https://www.zarinpal.com/pg/StartPay/' . $result->Authority);
} else {
    echo 'ERR: ' . $result->Status;
}
