File manager - Edit - /home/gppowercontrol/public_html/razorpay/result2.php
Back
<?php session_start(); require('Razorpay.php'); use Razorpay\Api\Api; // Include connection file include('../include/connection.php'); // Initialize Razorpay API with your key id and secret key $api_key = 'rzp_test_LbkqjnfmRYuaoM'; // Replace with your Razorpay API key $api_secret = 'oNV9GSJX6COIJ3hR4XhXyd2M'; // Replace with your Razorpay API secret $api = new Api($api_key, $api_secret); // Get payment response data $response = json_decode(file_get_contents('php://input'), true); // Verify signature $signatureStatus = $api->utility->verifyPaymentSignature($response); if ($signatureStatus) { // Payment is successful $paymentId = $response['razorpay_payment_id']; $orderId = $response['razorpay_order_id']; $signature = $response['razorpay_signature']; // Capture payment try { $payment = $api->payment->fetch($paymentId); $payment->capture(array('amount' => $payment->amount)); } catch (Exception $e) { echo "Error capturing payment: " . $e->getMessage(); exit; } // Update order status in the database $status = $_REQUEST['payment_status']; $order_id = $_SESSION['OID']; if ($status == "Credit") { $trans_id = $paymentId; $sql = "UPDATE `orders` SET `payment_status`='1', `transaction_id`='$trans_id' WHERE `order_id` = '$order_id'"; $res = mysqli_query($con, $sql); if ($res) { // Fetch order details $sqlli = "SELECT * FROM `orders` WHERE `order_id` = '$order_id'"; $ros1 = mysqli_query($con, $sqlli); if ($ros1) { $res1 = mysqli_fetch_assoc($ros1); $name = $res1['fname'] . " " . $res1['lname']; $email = $res1['email']; $id = $res1['id']; $phone = $res1['p
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.75 |
proxy
|
phpinfo
|
Settings