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/create-checkout-session.php
<?php error_reporting(E_ALL); ini_set('display_errors', 1); require '../vendor/autoload.php'; use Stripe\Stripe; use Stripe\Checkout\Session; // Set the API key Stripe::setApiKey('sk_test_51QGPzg2K4CCTmLnJfSpCEOayDxZj6Cidz18qdEqZ19kcMIwWuOtfzTKNjW7xTc4OdAYGkRiATOFK0aHx9t2h0ujk00IXZmZnNA'); header('Content-Type: application/json'); try { // Retrieve JSON input $input = json_decode(file_get_contents('php://input'), true); if (!$input) { throw new Exception('Invalid JSON input.'); } $name = $input['name'] ?? 'Customer'; $email = $input['email'] ?? ''; $amount = floatval($input['amount'] * 100); // Convert to cents if ($amount <= 0) { throw new Exception('Invalid amount.'); } // Create the checkout session $checkout_session = Session::create([ 'payment_method_types' => ['card'], 'line_items' => [[ 'price_data' => [ 'currency' => 'cad', 'product_data' => [ 'name' => 'Motorcycle Rental', ], 'unit_amount' => $amount, ], 'quantity' => 1, ]], 'customer_email' => $email, 'mode' => 'payment', 'success_url' => 'https://alpenpass.ca/rental_success.php?session_id={CHECKOUT_SESSION_ID}', 'cancel_url' => 'https://alpenpass.ca/rental_cancel.php', ]); echo json_encode(['id' => $checkout_session->id]); } catch (Exception $e) { error_log('Error creating Stripe checkout session: ' . $e->getMessage()); http_response_code(500); echo json_encode(['error' => $e->getMessage()]); }