Advertisement
blackimpala

index_php

Mar 28th, 2024
885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.27 KB | None | 0 0
  1. <?php
  2. // Include configuration file
  3. //require_once '../config.php';
  4.  
  5. // Include database connection file
  6. include_once '../db_connection.php';
  7.  
  8. // Fetch Plans from database
  9. $sqlQ = "SELECT * FROM plans";
  10. $stmt = $con->prepare($sqlQ);
  11. $stmt->execute();
  12. $stmt->store_result();
  13.  
  14. ?>
  15.  
  16. <!DOCTYPE html>
  17. <html lang="en" dir="ltr">
  18.   <head>
  19.     <meta charset="utf-8">
  20.     <title>SIMCOPRO Subscription Payments</title>
  21.     <meta content="width=device-width, initial-scale=1.0" name="viewport">
  22.     <meta content="" name="keywords">
  23.     <meta content="" name="SIMCOPRO Subscription Payments Stripe">
  24.  
  25.     <!-- Google Web Fonts -->
  26.     <link rel="preconnect" href="https://fonts.googleapis.com">
  27.     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  28.     <link href="https://fonts.googleapis.com/css2?family=Heebo:wght@400;500&family=Jost:wght@500;600;700&display=swap" rel="stylesheet">
  29.  
  30.     <!-- Icon Font Stylesheet -->
  31.     <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet">
  32.     <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css" rel="stylesheet">
  33.  
  34.     <!-- Libraries Stylesheet -->
  35.     <link href="lib/animate/animate.min.css" rel="stylesheet">
  36.  
  37.     <!-- Customized Bootstrap Stylesheet -->
  38.     <link href="../css/bootstrap.min.css" rel="stylesheet">
  39.  
  40.     <!-- Template Stylesheet -->
  41.     <link href="../css/style.css" rel="stylesheet">
  42.   </head>
  43.   <body>
  44.     <main>
  45.       <div class="container">
  46.         <h1>Stripe Subscription Payment Gateway Integration</h1>
  47.         <div class="panel">
  48.           <div class="panel-heading">
  49.             <h3 class="panel-title">Subscription with Stripe</h3>
  50.             <div>
  51.               <p class="panel-title">Choose a Plan</p>
  52.               <select id="subscription_plan" class="form-control">
  53.                 <?php
  54.                 if ($stmt->num_rows > 0) {
  55.                   $stmt->bind_result($id, $name, $price, $interval);
  56.                   while ($stmt->fetch()) {
  57.                     $interval_str = ($interval_count > 1)?$interval_count.' '.$interval.'s':$interval;
  58.                     ?>
  59.                       <option value="<?php echo $id; ?>"><?php echo $name.' [$'.$price.'/'.$interval_str.']'; ?></option>
  60.                     <?php
  61.                   }
  62.                 }
  63.                  ?>
  64.               </select><!-- end select -->
  65.             </div><!-- end div -->
  66.           </div><!-- end panel-heading -->
  67.           <div class="panel-body">
  68.             <!-- display status message -->
  69.             <div id="paymentResponse" class="hidden"></div>
  70.             <!-- display subscription form -->
  71.             <form id="subscrForm" action="" method="post">
  72.                 <div class="row g-3">
  73.                     <div class="col-md-12 form-group">
  74.                       <label for="name">Your Name</label>
  75.                       <input type="text" class="form-control" id="name" placeholder="Your Name">
  76.                     </div>
  77.                     <div class="col-md-12 form-group">
  78.                       <label for="email">Your Email</label>
  79.                       <input type="email" class="form-control" id="email" placeholder="Your Email">
  80.                     </div>
  81.                     <div class="col-12 form-group">
  82.                       <div id="card-element">
  83.                         <!-- Stripe.js will create card input elements here -->
  84.                       </div>
  85.                     </div>
  86.                     <!-- Form submit button -->
  87.                     <button id="submitBtn" class="btn btn-primary-gradient rounded-pill py-3 px-5 text-center">
  88.                         <div class="spinner hidden" id="spinner"></div>
  89.                         <span id="buttonText">Proceed</span>
  90.                     </button>
  91.                 </div>
  92.             </form>
  93.           </div><!-- end panel-body -->
  94.         </div><!-- end panel -->
  95.       </div><!-- end container -->
  96.     </main>
  97.     <!-- Stripe JS Library -->
  98.     <script src="https://js.stripe.com/v3/"></script>
  99.     <!-- Custom Script to process checkout with Stripe API -->
  100.     <script src="js/checkout.js" STRIPE_PUBLISHABLE_KEY="<?php  echo STRIPE_PUBLISHABLE_KEY; ?>" defer></script>
  101.     <script src="..js/main.js"></script>
  102.   </body>
  103. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement