%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/sumupapi.php
<?php

session_start();

include('dbcon.php');

require_once 'vendor/autoload.php';

define('BASE_URL', 'https://dataduck.in/client-project/meatandgo/');

/*
|--------------------------------------------------------------------------
| Stripe Secret Key
|--------------------------------------------------------------------------
*/

\Stripe\Stripe::setApiKey(
    'sk_test_51TQ17RQWjw6TdwoVPE8TAu4MTPrqUz3lBRf8UzLj6I9aeeo177nvIQYGHx6oK5K3rRQHUAU7iadblC1ZcHNGGEZ200KeYO3kov'
);

/*
|--------------------------------------------------------------------------
| Currency
|--------------------------------------------------------------------------
*/

$currency_code = "eur";

/*
|--------------------------------------------------------------------------
| Get Order ID
|--------------------------------------------------------------------------
*/

$order_id = isset($_GET['order_id'])
    ? (int)$_GET['order_id']
    : 0;

if (!$order_id) {
    die("Invalid Order ID");
}

/*
|--------------------------------------------------------------------------
| Fetch Order
|--------------------------------------------------------------------------
*/

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

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

$order = $stmt->get_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' => $currency_code,

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

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

                'quantity' => 1,
            ]],

            'mode' => 'payment',

            'success_url' =>
                BASE_URL .
                'api/payment_success.php?order_id=' .
                $order_id .
                '&session_id={CHECKOUT_SESSION_ID}',

            'cancel_url' =>
                BASE_URL .
                'api/payment_failed.php?order_id=' .
                $order_id,
        ]);

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

} catch (Exception $e) {

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

VaKeR 2022