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
/
public_html
/
Upload File:
files >> //home2/apca/public_html/checkout.php
<?php session_start(); include('includes/config.php'); require '../vendor/autoload.php'; // Composer Stripe library \Stripe\Stripe::setApiKey('sk_test_51QGPzg2K4CCTmLnJfSpCEOayDxZj6Cidz18qdEqZ19kcMIwWuOtfzTKNjW7xTc4OdAYGkRiATOFK0aHx9t2h0ujk00IXZmZnNA'); $user_id = $_SESSION['id']; $stmt = $dbh->prepare("SELECT * FROM cart WHERE user_id = :user_id"); $stmt->execute([':user_id' => $user_id]); $cart_items = $stmt->fetchAll(PDO::FETCH_ASSOC); $line_items = []; $total_amount = 0; // Track total amount foreach ($cart_items as $item) { // Calculate taxes $subtotal = $item['price'] * $item['quantity']; $gst = ($subtotal * ($item['ProductsGSTRate'] / 100)); $pst = ($subtotal * ($item['ProductsPSTRate'] / 100)); $total = $subtotal + $gst + $pst; // Update total amount $total_amount += $total; // Add line item for Stripe $line_items[] = [ 'price_data' => [ 'currency' => 'cad', // Changed to CAD 'product_data' => ['name' => $item['product_name']], 'unit_amount' => round($total * 100), // Convert to cents ], 'quantity' => 1, // Taxed per full order amount ]; } // Create Stripe Checkout Session $checkout_session = \Stripe\Checkout\Session::create([ 'payment_method_types' => ['card'], 'line_items' => $line_items, 'mode' => 'payment', 'success_url' => 'https://alpenpass.ca/success.php?session_id={CHECKOUT_SESSION_ID}', 'cancel_url' => 'https://alpenpass.ca/cart.php', ]); header("Location: " . $checkout_session->url); exit;