blackimpala

payment_status_php

Mar 28th, 2024
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.52 KB | None | 0 0
  1.     <?php
  2.       //include configuration file
  3.       // require_once  'config.php';
  4.       //include the database connection file
  5.         require_once '../db_connection.php';
  6.  
  7.         $payment_id =  $statusMsg = '';
  8.         $status = 'error';
  9.       // check wheter the subscription ID is not empty
  10.         if(!empty($_GET['sid'])){
  11.            $subscr_id = base64_decode($_GET['sid']);
  12.            // Fetch subscription info from database
  13.            $sqlQ = "SELECT S.id, S.stripe_subscription_id, S.paid_amount, S.paid_amount_currency, S.plan_interval, S.plan_period_start,
  14.           S.plan_period_end, S.customer_name, S.customer_email, S.status, P.name as plan_name, P.price as plan_amount FROM user_subscriptions as S
  15.          LEFT JOIN plans as P On P.id = S.plan_id WHERE S.id = ?";
  16.           $stmt = $con->prepare($sqlQ);
  17.           $stmt->bindParam("i", $subscr_id);
  18.           $stmt->execute();
  19.           $stmt->store_result();
  20.             if($stmt->num_rows > 0){
  21.               //Subscription and transaction detail
  22.               $stmt->bind_result($subscription_id, $stripe_subscription_id, $paid_amount, $paid_amount_currency, $plan_interval, $plan_period_start,
  23.                 $plan_period_end, $customer_name, $customer_email, $subscr_status, $plan_name, $plan_amount);
  24.               $stmt->fetch();
  25.               $status = 'success';
  26.               $statusMsg = 'Yor subscription Payment has been Successful!';
  27.             }else{
  28.               $statusMsg = 'Transaction has been failed!';
  29.             }
  30.         }else{
  31.           header("Location:index.php");
  32.           exit();
  33.         }
  34.       ?>
  35. <!DOCTYPE html>
  36. <html lang="en" dir="ltr">
  37.   <head>
  38.     <meta charset="utf-8">
  39.     <title>SIMCOPRO Home</title>
  40.     <meta content="width=device-width, initial-scale=1.0" name="viewport">
  41.     <meta content="" name="keywords">
  42.     <meta content="" name="SIMCOPRO Subscription Payments Stripe">
  43.  
  44.     <!-- Google Web Fonts -->
  45.     <link rel="preconnect" href="https://fonts.googleapis.com">
  46.     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  47.     <link href="https://fonts.googleapis.com/css2?family=Heebo:wght@400;500&family=Jost:wght@500;600;700&display=swap" rel="stylesheet">
  48.  
  49.     <!-- Icon Font Stylesheet -->
  50.     <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet">
  51.     <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css" rel="stylesheet">
  52.  
  53.     <!-- Libraries Stylesheet -->
  54.     <link href="lib/animate/animate.min.css" rel="stylesheet">
  55.  
  56.     <!-- Customized Bootstrap Stylesheet -->
  57.     <link href="../css/bootstrap.min.css" rel="stylesheet">
  58.  
  59.     <!-- Template Stylesheet -->
  60.     <link href="css/style.css" rel="stylesheet">
  61.   </head>
  62.   <body>
  63.     <main>
  64.       <div class="container">
  65.         <h1>SIMCOPRO HomePage</h1>
  66.         <div class="panel">
  67.           <div class="panel-heading">
  68.             <h3 class="panel-title">HomePage</h3>
  69.           </div><!-- end panel-heading -->
  70.           <div class="panel-body">
  71.             <?php if(!empty($subscription_id)){?>
  72.               <h1 class="<?php echo $status; ?>"> <?php echo $statusMsg; ?> </h1>
  73.               <h4>Payment Information</h4>
  74.               <p><b>Reference Number:</b> <?php echo $subscription_id;?></p>
  75.               <p><b>Subscription ID:</b> <?php echo $stripe_subscription_id;?></p>
  76.               <p><b>Paid Amount:</b> <?php echo $paid_amount.' '.$paid_amount_currency;?></p>
  77.               <p><b>Status:</b> <?php echo $subscr_status;?></p>
  78.  
  79.               <h4>Subscription Information</h4>
  80.               <p><b>Plan Name:</b> <?php echo $plan_name;?></p>
  81.               <p><b>Amount:</b> <?php echo $plan_amount.' '.STRIPE_CURRENCY;?></p>
  82.               <p><b>Plan Interval:</b> <?php echo $plan_interval;?></p>
  83.               <p><b>Period Start:</b> <?php echo $plan_period_start;?></p>
  84.               <p><b>Period End:</b> <?php echo $plan_period_end;?></p>
  85.  
  86.               <h4>Customer Information</h4>
  87.               <p><b>Name:</b> <?php echo $customer_name;?></p>
  88.               <p><b>Email:</b> <?php echo $customer_email;?></p>
  89.               <?php }else{?>
  90.                 <h1 class="error">Your transaction has been failed!</h1>
  91.                 <p class="error"><?php echo $statusMsg; ?></p>
  92.             <?php } ?>
  93.           </div>
  94.           <a href="index.php" class="btn_link">Back to Home Page</a>
  95.         </div><!-- end panel -->
  96.       </div>
  97.     </main>
  98.     <!-- Stripe JS Library -->
  99.     <script src=""></script>
  100.   </body>
  101. </html>
  102.  
Add Comment
Please, Sign In to add comment