%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/public_html/website_6ca89795/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/public_html/website_6ca89795/sumup-strip.php
<?php

session_start();
include('dbcon.php');

require_once __DIR__ . '/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| STRIPE SECRET KEY
|--------------------------------------------------------------------------
*/
\Stripe\Stripe::setApiKey(
    'sk_test_51TQ17RQWjw6TdwoVPE8TAu4MTPrqUz3lBRf8UzLj6I9aeeo177nvIQYGHx6oK5K3rRQHUAU7iadblC1ZcHNGGEZ200KeYO3kov'
);

/*
|--------------------------------------------------------------------------
| GET ORDER ID
|--------------------------------------------------------------------------
*/
$order_id = isset($_GET['order_id']) ? (int)$_GET['order_id'] : 0;

if ($order_id <= 0) {
    die("Invalid Order ID");
}

/*
|--------------------------------------------------------------------------
| FETCH ORDER
|--------------------------------------------------------------------------
*/
$stmt = $conn->prepare("
    SELECT
        total_amount,
        unique_order_id
    FROM orders
    WHERE id = ?
");

if (!$stmt) {
    die("DB Error : " . $conn->error);
}

$stmt->bind_param("i", $order_id);
$stmt->execute();

$result = $stmt->get_result();
$order  = $result->fetch_assoc();

$stmt->close();

if (!$order) {
    die("Order not found");
}

$amount = (float)$order['total_amount'];

$unique_order_id = !empty($order['unique_order_id'])
    ? $order['unique_order_id']
    : $order_id;

try {

    $checkout_session = \Stripe\Checkout\Session::create([

        'payment_method_types' => ['card'],

        'line_items' => [[

            'price_data' => [

                'currency' => 'usd',

                'product_data' => [
                    'name' => 'Order #' . $unique_order_id
                ],

                'unit_amount' => intval($amount * 100)

            ],

            'quantity' => 1

        ]],

        'mode' => 'payment',

        'success_url' =>
            'https://dataduck.in/client-project/meatandgo/payment_success.php?order_id=' .
            $order_id .
            '&session_id={CHECKOUT_SESSION_ID}',

        'cancel_url' =>
            'https://dataduck.in/client-project/meatandgo/payment_failed.php?order_id=' .
            $order_id,

        'metadata' => [
            'order_id' => $order_id
        ]

    ]);

    header("Location: " . $checkout_session->url);
    exit;

} catch (Exception $e) {

    die("Stripe Error: " . $e->getMessage());
}

VaKeR 2022