ok

Mini Shell

Direktori : /proc/self/root/home2/selectio/www/y1jobportal.in/
Upload File :
Current File : //proc/self/root/home2/selectio/www/y1jobportal.in/payment-redirect.php

<?php
include 'header.php';
include 'admin/api/config/config.php'; // Assuming config.php file exists and contains necessary configurations
$app_name = "Y1JOB";
// $access_key = "rzp_test_QPuepWvrvsEsgp"; // Test access key, replace with live key for production
$access_key = "rzp_live_mjshpQI4FMc0rF"; // Test access key, replace with live key for production
$site_url = "https://y1jobportal.in";

// Sanitize and validate $_GET['id'] before using it in the query
$id = isset($_GET['id']) ? $_GET['id'] : null;
if (!is_numeric($id)) {
    // Handle invalid or missing ID, perhaps redirect to an error page
}

// Prepare and execute the query
$selectQuery = "SELECT * FROM customer WHERE id = ?";
$selectStatement = $pdo->prepare($selectQuery);
$selectStatement->execute([$id]);
$data = $selectStatement->fetchAll(PDO::FETCH_ASSOC);

?>
<div style="height:50vh" ></div>

<div hidden class="container mt-3" style="width: 50%;">
  <form id="paymentForm" method="post">
    <div class="mb-3 mt-3">
      <label for="payee_name">Name:</label>
      <input type="text" class="form-control" id="payee_name" placeholder="Enter Payee Name" name="name" value='<?= $data[0]['cust_firstname'] ?>'>
      <input type="text" class="form-control" id="customerId" placeholder="Enter Payee Name" name="customerId" value='<?= $id ?>'>
    </div>
    <div class="mb-3">
      <label for="amount">Amount:</label>
      <input readonly type="number" class="form-control" id="amount" placeholder="Enter Amount" name="amount" value='100'>
    </div>

    <br>
    <center><button type="button" class="btn btn-sm btn-primary" id="rzp-button1">Pay</button></center>
    <!-- Add any other form fields if needed -->
  </form>
  <form id="payment_form" method="POST" hidden action="apps-api/web-payment.php">
    <input type="hidden" id="payment_details_input" name="payment_details">
  </form>

</div>

<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script type="text/javascript">
  function pay_now() {
    var name = $("#payee_name").val();
    console.log(name)
    var amount = $("#amount").val();
    console.log(amount)
    var id = $('#customerId').val();
    console.log(id)

    var options = {
      "key": "<?= $access_key ?>",
      "amount": amount * 100, // Convert amount to paise if using INR
      "currency": "INR",
      "name": name,
      "description": "Payment for <?= $app_name ?>",
      "image": "razorpay.png",
      "handler": function(response) {
        var paymentDetails = {
          "razorpay_payment_id": response.razorpay_payment_id,
          "name": name,
          "amount": amount,
          "id": id,
        };

        var paymentDetailsString = JSON.stringify(paymentDetails);

        $('#payment_details_input').val(paymentDetailsString);

        $('#payment_form').submit();
      },
      "prefill": {
        "name": name,
        "email": ""
      },
      "theme": {
        "color": "#3399cc"
      }
    };

    var rzp1 = new Razorpay(options);
    rzp1.open();
  }

  $(document).ready(function() {
    $('#rzp-button1').on('click', function(e) {
      e.preventDefault();
      pay_now();
    });

    // Initial call to pay_now()
    pay_now();
  });
</script>

<?php include 'footer.php' ?>

Zerion Mini Shell 1.0