<?php

$a_amount = $_GET["amount"];
$a_chid = $_GET["id"];
$package = $_GET["package"];


$MerchantID = '43d26f3a-4c56-4165-8bbd-350e97c145c9'; //Required

$Amount = $a_amount;


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

$CallbackURL = "https://bots.ahpbot.com/dev_test/malek/finishpaying.php?id=$a_chid&package=$package&amount=$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;
}

?>