0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.15.26.184


Current Path : /proc/thread-self/root/var/www/oasis/vskub/razorpay/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/vskub/razorpay/pay.php

<?php

require('config.php');
require('razorpay-php/Razorpay.php');
include("/var/www/config.php");
session_start();

// Create the Razorpay Order

use Razorpay\Api\Api;

$api = new Api($keyId, $keySecret);

$appno     = $_POST['appno'];
$funivcode = $_POST['funivcode'];
    


$servername = SERVERNAME;
$username = USERNAME;
$password = PASSWORD;

$dbname = "logisys3_vku";

$conn = new mysqli($servername, $username, $password, $dbname);  

$get_data = "select cs.fcollcode as fregno, ftotalsum as ftotalfee,control.funivname,pdf_logo_path, 
fmobileno as fmobileno
,cs.fprincipalname as fname,c.femail as femail
from control, affliation_sum cs 
inner join college c on cs.fcollcode = c.fcollcode
where fsaffid = '{$appno}'";
//var_dump($get_data);
$result=$conn->query($get_data); 

if (mysqli_num_rows($result) > 0) 
{
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) 
    {
        $fregno    =    $row['fregno'];
        $ftotalfee =    $row['ftotalfee'];
        $fname     =    $row['fname'];
        $fmobileno =    $row['fmobileno'];
        $femail    =    $row['femail'];
        $funivname =    $row['funivname'];
        $logo      =    $row['pdf_logo_path'];        
    }
}

$number = rand(10000001,99999999);
//
// We create an razorpay order using orders api
// Docs: https://docs.razorpay.com/docs/orders



//
$orderData = [
    'receipt'         => $number,
    'amount'          => $ftotalfee * 100, // 2000 rupees in paise
    'currency'        => 'INR',
    'payment_capture' => 1 // auto capture
];

$razorpayOrder = $api->order->create($orderData);

$razorpayOrderId = $razorpayOrder['id'];

$_SESSION['razorpay_order_id'] = $razorpayOrderId;

$displayAmount = $amount = $orderData['amount'];

$query = "update affliation_sum set forderid = '{$razorpayOrderId}', fpaymenttype = 'razorpay' 
where fsaffid = '{$appno}'";

$result1 =$conn->query($query); 


if ($displayCurrency !== 'INR')
{
    $url = "https://api.fixer.io/latest?symbols=$displayCurrency&base=INR";
    $exchange = json_decode(file_get_contents($url), true);

    $displayAmount = $exchange['rates'][$displayCurrency] * $amount / 100;
}

$checkout = 'manual';

if (isset($_GET['checkout']) and in_array($_GET['checkout'], ['automatic', 'manual'], true))
{
    $checkout = $_GET['checkout'];
}

//var_dump($checkout);die();

$data = [
    "key"               => $keyId,
    "amount"            => $amount,
    "name"              => $funivname,
    "description"       => "Affiliation Fee",
    "image"             => "https://universitysolutions.in/vskub/img/logo.jpg",
    "prefill"           => [
    "name"              => $fname,
    "email"             => $femail,
    "contact"           => $fmobileno,
    ],
    "notes"             => [
    "appno"             => $appno,
    "univcode"          => $funivcode,
    "regno"             => $fregno
    ],
    "theme"             => [
    "color"             => "#F37254"
    ],
    "order_id"          => $razorpayOrderId,
];

if ($displayCurrency !== 'INR')
{
    $data['display_currency']  = $displayCurrency;
    $data['display_amount']    = $displayAmount;
}

$json = json_encode($data);

require("checkout/{$checkout}.php");