<?php

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


//$MerchantID = '3c0abf78-5f32-4c6f-8986-de2298f0addd'; //Required
$MerchantID = '9eca98ba-543b-458c-9cdb-6c7969352ffa'; //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;
}

?>