%PDF- %PDF-
Direktori : /home/eirtvhdf/logobrainiac.com/stripe/ |
Current File : //home/eirtvhdf/logobrainiac.com/stripe/cart_checkout.php |
<?php session_start(); $name = $_POST['name']; $street = $_POST['street']; $city = $_POST['city']; $email = $_POST['email']; $contact = $_POST['contact']; $pwd = $_POST['pwd']; $mysqli = mysqli_query($dbh,"insert into users values('','$name','$email','$pwd','$contact','$street','$city')"); $last_id = mysqli_insert_id($dbh); $package_id = array_column($_SESSION['cart'], 'package_id'); $sql = "SELECT * FROM Packages ORDER BY id DESC"; $result = mysqli_query($dbh,$sql) or die(mysqli_error($dbh)); while ($row = mysqli_fetch_assoc($result)){ foreach ($package_id as $id){ if ($row['id'] == $id){ $package = $row['Package']; $price = $row['Price']; mysqli_query($dbh,"insert into cart_details values('','$last_id','$id','$package','$price')"); } } } session_destroy(); /*foreach ($_POST as $key => $value) { echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>"; }*/ ?> <?php require_once('../root_stripe/stripe/init.php'); ?> <?php // Set your secret key: remember to change this to your live secret key in production // See your keys here: https://dashboard.stripe.com/account/apikeys //\Stripe\Stripe::setApiKey("sk_test_yAeBLEexLzniHQPix52aXQ4H"); \Stripe\Stripe::setApiKey("sk_live_YpU9lRbjxmCwUELJH6TJJgOZ"); // Token is created using Checkout or Elements! // Get the payment token ID submitted by the form: $token = $_POST['stripeToken']; $amount = $_POST['stripeAmount']; $desc = $_POST['stripeDesc']; $charge = \Stripe\Charge::create([ 'amount' => $amount, 'currency' => 'eur', 'description' => $desc, 'source' => $token, 'receipt_email' => 'fahadansari91@gmail.com', ]); //echo $charge; //header('Location: '.'/eirtechs/'); header('Location: '.'/thankyou.php'); ?>