| Server IP : 68.178.172.28 / Your IP : 216.73.216.32 Web Server : Apache System : Linux 28.172.178.68.host.secureserver.net 4.18.0-553.89.1.el8_10.x86_64 #1 SMP Mon Dec 8 03:53:08 EST 2025 x86_64 User : kiskarnal ( 1003) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/kiskarnal/public_html/app/Http/Controllers/ |
Upload File : |
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Razorpay\Api\Api;
use Session;
use Redirect;
use DB;
class RazorpayController extends Controller
{
public function payment(Request $request)
{
$input = $request->all();
$api = new Api(env('RAZOR_KEY'), env('RAZOR_SECRET'));
$payment = $api->payment->fetch($input['razorpay_payment_id']);
if(count($input) && !empty($input['razorpay_payment_id']))
{
try
{
$response = $api->payment->fetch($input['razorpay_payment_id'])->capture(array('amount'=>$payment['amount']));
$lead = Session::get('lead');
$amount = $payment['amount']/100;
DB::table('leads')
->where('id', $lead->id) // find your user by their email
->limit(1) // optional - to ensure only one record is updated.
->update(array('razorpay_payment_id' => $input['razorpay_payment_id'] ,'amount' => $amount )); // update the record in the DB.
$admission_number = Session::get('admission_number');
$phone = Session::get('phone');
//send email to user
$username = Session::get('username');
$password = Session::get('password');
// Send the email
$to = $username; // Replace with the user's email address
$subject = 'Your KIS Registration';
$message = "Your Registration number: $admission_number\nYour username: $username";
$this->send_link_to_number($phone,$admission_number);
// Additional headers
$headers = 'From: info@kiskarnal.in ' . "\r\n" .
'Reply-To: info@kiskarnal.in ' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
// Send the email
if (mail($to, $subject, $message, $headers)) {
// echo 'Email sent successfully.';
} else {
//echo 'Email could not be sent.';
}
}
catch (\Exception $e)
{
return $e->getMessage();
\Session::put('error',$e->getMessage());
return redirect()->back();
}
}
\Session::put('success', 'Payment successful, Please check your email ID to get Registration no.');
return redirect()->to('parent/login');
}
public function send_link_to_number($phone,$admission_number){
$number=$phone;
$reg_no =$admission_number;
$msg=urlencode("Your registration has been done successfully and your registration no. is ".$reg_no." and you can download your admit card on click of below link: https://kiskarnal.in/parent/login?q=".$reg_no." From : Karnal International School");
$url="https://sms.k7marketinghub.com/app/smsapi/index.php?key=465AFA26A5C479&campaign=15724&routeid=100922&type=text&contacts=".$number."&senderid=KARlNS&msg=".$msg."&template_id=1707170904010667940";
// Initialize a CURL session.
$ch = curl_init();
// Return Page contents.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//grab URL and pass it to the variable.
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
}
}