Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
revealability
/
Stripe
:
index.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php session_start(); require_once("../admin/database.php"); if(isset($_POST['final_checkout'])) { $order_id=rand(10,100000); $query="SELECT * from orders WHERE order_id='$order_id'"; $order=db::getRecord($query); if($order!=NULL) { while($order!=NULL) { $order_id=rand(10,100000); $query="SELECT * from orders WHERE order_id='$order_id'"; $order=db::getRecord($query); } } $_SESSION['order_id']=$order_id; $user_id=session_id(); $_SESSION['user_id']=$user_id; // print_r ($user_id); $query="SELECT * from temp_cart WHERE user_id='$user_id'"; $cart=db::getRecords($query); $size=NULL; if(is_array($cart)) { $size=sizeof($cart); } $db = db::open(); $name = $db->real_escape_string($_POST['fname']); $l_name = $db->real_escape_string($_POST['lname']); $f_name=$name." ".$l_name; $email = $db->real_escape_string($_POST['email']); $address = $db->real_escape_string($_POST['address']); $zip = $db->real_escape_string($_POST['postcode']); $city = $db->real_escape_string($_POST['city']); $phone = $db->real_escape_string($_POST['phone']); $order_note = $db->real_escape_string($_POST['note']); $total_bill = $_POST['total_amount']; $payment_method = "Stripe"; $payment_status = "Unpaid"; $total_products=$size; if($cart!=null) { foreach($cart as $cart2) { $product_id=$cart2['product_id']; $quantity=$cart2['quantity']; $query="SELECT * from product WHERE id='$product_id'"; $product=db::getRecord($query); $query="SELECT * from product where id='$product_id'"; $product=db::getRecord($query); $product_name = $product['name']; $product_price = $product['price']; $query="INSERT into order_detail (order_id,user_id,product_id,product_name,quantity,total) VALUES ('$order_id','$user_id','$product_id','$product_name','$quantity','$product_price')"; $insert=db::query($query); } } $query="INSERT into orders (order_id,user_id,name,email,address,postcode,city,phone,note,total_products,total_bill,payment_status,payment_method) VALUES ('$order_id','$user_id','$f_name','$email','$address','$zip','$city','$phone','$order_note','$total_products','$total_bill','$payment_status','$payment_method')"; $insert=db::query($query); $total_bill=$total_bill * 100; $_SESSION['total_bill']=$total_bill; $shoping = "luxury Event"; } ?> <?php require_once('vendor/autoload.php'); \Stripe\Stripe::setApiKey('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'); $session = \Stripe\Checkout\Session::create([ 'payment_method_types' => ['card'], 'line_items' => [[ 'price_data' => [ 'currency' => 'USD', 'product_data' => [ 'name' => $shoping, ], 'unit_amount' => $total_bill, ], 'quantity' => 1, ]], 'mode' => 'payment', 'success_url' => 'https://sassyflyluxuryevents.com/Stripe/charge.php', 'cancel_url' => 'https://sassyflyluxuryevents.com/', /* 'success_url' => 'http://localhost:8080/luxury_event_v9/Stripe/charge.php', 'cancel_url' => 'http://localhost:8080/luxury_event_v9/',*/ ]); ?> <html> <head> <script src="https://js.stripe.com/v3/"></script> </head> <body> <script> var stripe = Stripe('pk_live_51MKmcuAuNyW2BVBV8JmHeGaxuMPVqRMja3wJD9sJhXkboAtXcBGD8XGIXkHArJS07ckRcNBYVVnh8TapP8cTNBx600i1oBkpvl'); stripe.redirectToCheckout({ sessionId: "<?php echo $session->id; ?>" }); </script> </body> </html>