File manager - Edit - /home/gppowercontrol/public_html/razorpay/pay.php
Back
<head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <?php session_start(); require('Razorpay.php'); use Razorpay\Api\Api; // Include connection file include('../include/connection.php'); if (isset($_POST['pay'])) { $order_id = $_POST['order_id']; $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $discount = $_POST['discount']; $amount = $_POST['amount']; $uid = $_POST['user_id']; $_SESSION['UID'] = $uid; $_SESSION['OID'] = $order_id; // Initialize Razorpay API with your key id and secret key $api_key = 'rzp_live_n5mucgNiWWLx8R'; // Replace with your Razorpay API key $api_secret = 'f3KQLQVo2gUVa9TN6BnXHM4z'; // Replace with your Razorpay API secret $api = new Api($api_key, $api_secret); try { // Create an order $order = $api->order->create(array( 'receipt' => $order_id, // Assign order ID to 'receipt' 'amount' => $amount * 100, // Razorpay accepts amount in paisa 'currency' => 'INR', 'payment_capture' => 1 // Auto capture payment )); // Get order id $orderId = $order->id; // Display payment form to the user echo ' <html> <head> <title>Payment</title> <script src="https://checkout.razorpay.com/v1/checkout.js"></script> </head> <body> <form action="result.php" method="POST"> <script src="https://checkout.razorpay.com/v1/checkout.js" data-key="' . $api_key . '" data-amount="' . $amount * 100 . '" data-currency="INR" data-order_id="' . $orderId . '" data-buttontext="Pay with Razorpay" data-name="Radian Books" data-prefill.name="' . htmlspecialchars($name) . '" data-prefill.email="' . htmlspecialchars($email) . '" data-prefill.contact="' . htmlspecialchars($phone) . '" data-theme.color="#F37254" ></script> <input type="hidden" name="order_id" value="' . $orderId . '"> <input type="hidden" value="Hidden Element" name="hidden"> </form> </body> </html>'; } catch (Exception $e) { echo "Razorpay Error: " . htmlspecialchars($e->getMessage()); } } else { // Redirect or handle the case where 'pay' parameter is not set echo "Razorpay Error: 'pay' parameter is not set."; } ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.75 |
proxy
|
phpinfo
|
Settings