BLACKSITE
:
216.73.217.4
:
104.37.75.190 / alpenpass.ca
:
Linux server3.pointsplan.com 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
:
/
home2
/
apca
/
www
/
Upload File:
files >> //home2/apca/www/success.php
<?php session_start(); include('includes/config.php'); if (!isset($_GET['session_id'])) { die("Session ID not provided."); } require_once '../vendor/autoload.php'; // Set Stripe API key \Stripe\Stripe::setApiKey('sk_test_51QGPzg2K4CCTmLnJfSpCEOayDxZj6Cidz18qdEqZ19kcMIwWuOtfzTKNjW7xTc4OdAYGkRiATOFK0aHx9t2h0ujk00IXZmZnNA'); try { // Retrieve the checkout session from Stripe $session = \Stripe\Checkout\Session::retrieve($_GET['session_id']); // Get customer and payment details $user_id = $_SESSION['id']; // Assuming user ID is stored in the session $stripe_session_id = $session->id; $amount = $session->amount_total / 100; // Stripe uses cents $currency = $session->currency; $payment_status = $session->payment_status; $transaction_details = json_encode($session); // Optional: Store full session details // Ensure the payment was successful if ($payment_status === 'paid') { // Insert the transaction into the database $query = $dbh->prepare(" INSERT INTO transactions (user_id, stripe_session_id, amount, currency, payment_status, date_created, transaction_details) VALUES (:user_id, :stripe_session_id, :amount, :currency, :payment_status, NOW(), :transaction_details) "); $query->execute([ ':user_id' => $user_id, ':stripe_session_id' => $stripe_session_id, ':amount' => $amount, ':currency' => $currency, ':payment_status' => $payment_status, ':transaction_details' => $transaction_details, ]); // Check if the transaction was recorded successfully if ($query->rowCount() > 0) { $message.= "<h1>Payment Successful!</h1>"; $message.= "<p>Your order has been successfully placed.</p>"; $message.= "<a href=\"product_listing.php\" class=\"btn btn-primary btn-md mt-2\" \>Continue Shopping</a>"; } else { $message.= "<h1>Error</h1>"; $message.= "<p>There was an issue recording your transaction. Please contact support.</p>"; $message.= "<a href=\"cart.php\" class=\"btn btn-primary btn-md mt-2\" \>Return to Cart</a>"; } } else { $message.= "<h1>Payment Failed</h1>"; $message.= "<p>We could not process your payment. Please try again.</p>"; $message.= "<a href=\"cart.php\" class=\"btn btn-primary btn-md mt-2\" \>Return to Cart</a>"; } } catch (Exception $e) { // Handle errors error_log($e->getMessage()); $message.= "<h1>Error</h1>"; $message.= "<p>An error occurred while processing your payment. Please contact support.</p>"; $message.= "<a href=\"cart.php\" class=\"btn btn-primary btn-md mt-2\" \>Return to Cart</a>"; } ?> <?php include("includes/head.php"); include("includes/header.php"); ?> <body> <style> h1{ font-size: 96px; } </style> <div class="container" style="min-height: 500px;"> <div class="row justify-content-center"> <div class="col-sm-12"> <p><?php echo $message; ?></p> </div> </div> </div> <!--Footer --> <?php include('includes/footer.php');?> <!-- /Footer--> <!--Back to top--> <div id="back-top" class="back-top"> <a href="#top"><i class="fa fa-angle-up" aria-hidden="true"></i> </a> </div> <!--/Back to top--> <!--Login-Form --> <?php include('includes/login.php');?> <!--/Login-Form --> <!--Register-Form --> <?php include('includes/registration.php');?> <!--/Register-Form --> <!--Forgot-password-Form --> <?php include('includes/forgotpassword.php');?> <script src="assets/js/jquery.min.js"></script>