Anons79 Mini Shell

Directory : /home/proudlyafrican/public_html/resources/views/general/
Upload File :
Current File : /home/proudlyafrican/public_html/resources/views/general/paywithstripe.blade.php

@extends('general.head')
@section('middle')

<head>
    <title>@section('title', 'Cart-')Ckgroceries</title>
    <meta name="keywords" content="Ckgroceries Stripe payment, online shoping, Best e-commerce site, online groceresie products" />
</head>

<style>

</style>

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>

<!-- Popper JS -->
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

<style>
    .ads-grid, footer, .contact-w3l, .w3_wthree_agileits_icons, .typo, .faqs-w3l, .terms-of-use, .welcome, .about, .banner-bootom-w3-agileits, .privacy {
        padding: 2em 0;
    }


</style>

<div class="page-head_agile_info_w3l">

</div>
<!-- //banner-2 -->
<!-- page -->
<div class="services-breadcrumb">
    <div class="agile_inner_breadcrumb">
        <div class="container">
            <ul class="w3_short">
                <li>
                    <a href="{{ url('/') }}">Home</a>
                    <i>|</i>
                </li>
                <li>Payment</li>
            </ul>
        </div>
    </div>
</div>
<!-- //page -->
<!-- Single Page -->
<div class="banner-bootom-w3-agileits">
    <div class="container">

    <div class="row">
        <div class="col-md-2">
        </div>
        <div class="col-md-8">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <i class="fa fa-bar-chart fa-lg"></i> <strong>Ship To</strong>
                </div>
                <div class="panel-body">

                    {{ $first_name }}  {{ $last_name }}<br>
                    {{ $address1 }}<br>
                    @if($address2=="")
                    @else
                    {{ $address2 }}<br>
                    @endif
                    {{ $city }},<br>
                    {{ $zip }},<br>{{ $country_name }}



                    @if($phone=="")
                    @else
                    <br>
                    {{ $phone }}
                    @endif


                    @if(Session::get('user_id')=="")
                    <br>
                    {{ $guest_email }}
                    @else
                    <br>
                    {{ Session::Get('user_email') }}
                    @endif

                </div>

            </div>
        </div>
    </div>





    <div class="row">
        <div class="col-md-2">
        </div>
        <div class="col-md-8">
            <div  style="background: white">
                <div class="row" style="" id="Carddiv">

                    <div id="loading" class="loaders" style=" border-radius: 50% !important;display:none;">
                    </div>

                    <div class=" col-lg-12" >
                        <div class="panel panel-default" style="    border: 1px solid lightgray !important;">

                            <div class="panel-body">
                                <!-- Display errors returned by createToken -->
                                <div id="paymentResponse" style="color: red"></div>



                                <!-- Payment form -->
                                <form id="paymentFrm" style="padding: 10px">

                                    <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">

                                    <input type="hidden" value="" name="" id="paymenttype">
                                    <div id="card_number" class=" invert_dark form-control" style="display:inline-block;border-radius: 5px;"></div>


                                    <div align="center">
                                        <ul class="nav nav-pills nav-stacked mt-2">
                                            <li class="active"><a>Final Payment : £<span id="finalpayment">{{ $grandtotal }}</span> </a>
                                            </li>
                                        </ul>
                                    </div>

                                    <br />
                                    <button style="color:#fff;font-weight:bold; height: 50px" type="submit" class="btn-success btn-block" id="submit">Pay</button>
                                    <input type="hidden" value="{{ $grandtotal }}" name="onlinepayment" id="onlinepayment">
                                </form>
                                <form id="form_success" method="post" action="{{ url('order_success') }}">
                                    <input type="hidden" name="_token" value="<?php  echo csrf_token(); ?>">
                                    <input type="hidden" id="payment_intent_id" name="payment_intent_id" value="">
                                    <input type="hidden" id="first_name" name="first_name" value="{{ $first_name }}">
                                    <input type="hidden" name="last_name" value="{{ $last_name }}">
                                    <input type="hidden" name="grandtotal" value="{{ $grandtotal }}">
                                    <input type="hidden" name="coupen_user_id" value="{{ $coupen_user_id }}">
                                    <input type="hidden" name="company" value="{{ $company }}">
                                    <input type="hidden" name="address1" value="{{ $address1 }}">
                                    <input type="hidden" name="address2" value="{{ $address2 }}">
                                    <input type="hidden" name="subtotal" value="{{ $subtotal }}">
                                    <input type="hidden" name="city" value="{{ $city }}">
                                    <input type="hidden" name="zip" value="{{ $zip }}">
                                    <input type="hidden" name="phone" value="{{ $phone }}">
                                    <input type="hidden" id="guest_email" name="guest_email" value="{{ $guest_email }}">
                                    <input type="hidden" name="country_id" value="{{ $country_id }}">

                                    <input type="hidden" name="coupen_discount" value="{{ $coupen_discount }}">
                                    <input type="hidden" name="shipping_charge" value="{{ $shipping_charge }}">
                                    <input type="hidden" name="tax_percentage" value="{{ $tax_percentage }}">
                                    <input type="hidden" name="tax_amount" value="{{ $tax_amount }}">

                                    <input value="sdfsdfsdfsd" type="hidden" name="hidden_card_number" id="hidden_card_number">

                                </form>

                                <div align="center" style="font-size: 11px; font-weight: bold; color: red">
                                    <p style="font-size: 11px; font-weight: bold; color: red">* Note: For any refund claim, the card processing fees are NOT refunded.
                                    </p>

                                </div>

                            </div>


                        </div>

                    </div>

                </div>
            </div>


            <script src="/public/frontend/assets/js/vendor/swal.js"></script>

            <script src="https://js.stripe.com/v3/"></script>
            <script>
                // Create an instance of the Stripe object
                // Set your publishable API key

                var stripe = Stripe('pk_test_51HmHWVJHMNVpHtGYRXIH0y8NlDYqOkBmhN4wofXUusp2SPPafKgimJ7hfwEC2W1jZuq6oR6lZkki8Juzp87QKNOq00IqBArCX4', {
                    stripeAccount: "acct_1HoBbTFf3sA3e1Z8"
                });
                // Create an instance of elements
                var elements = stripe.elements();

                var style = {
                    base: {
                        fontWeight: 400,
                        fontFamily: 'Roboto, Open Sans, Segoe UI, sans-serif',
                        fontSize: '16px',
                        lineHeight: '1.4',
                        color: '#555',
                        backgroundColor: '#fff',
                        '::placeholder': {
                            color: '#888',
                        },

                    },
                    invalid: {
                        color: 'red',
                    }
                };

                var cardElement = elements.create('card', {
                    style: style
                });
                cardElement.mount('#card_number');



                // Validate input of the card elements
                var resultContainer = document.getElementById('paymentResponse');
                cardElement.addEventListener('change', function(event) {
                    if (event.error) {
                        resultContainer.innerHTML = '<p>'+event.error.message+'</p>';
                    } else {
                        resultContainer.innerHTML = '';
                    }
                });

                // Get payment form element
                var form = document.getElementById('paymentFrm');

                // Create a token when the form is submitted.
                form.addEventListener('submit', function(ev) {
                    ev.preventDefault();
                    $("#submit").text("Payment Processing");
                    $("#submit").prop("disabled",true);

                    var client_secret="";
                    /////////////////
                    var keyword="payment_intent";
                    var onlinepayment=$('#onlinepayment').val();
                    var guest_email=$('#guest_email').val();
                    var name=$('#first_name').val();
                    $.ajax({
                        type: 'POST',
                        url: "{{ url('create_payment_intent') }}",
                        data: {"keyword":keyword, "_token": "{{ csrf_token() }}","onlinepayment":onlinepayment,'guest_email':guest_email,'name':name},
                        success: function(data){
                            obj = data;
                            console.log(data);
                            if(obj.status!=false)
                            {
                                /////////////////

                                stripe.confirmCardPayment(""+obj.client_secret+"", {
                                    payment_method: {
                                        card: cardElement

                                    }
                                }).then(function(result) {
                                    if (result.error) {
                                        // Show error to your customer (e.g., insufficient funds)
                                        console.log(result.error.message);
                                        $("#submit").prop("disabled",false);
                                        $("#submit").text("Pay");

                                        swal("Sorry!",result.error.message,'warning');
                                    } else {
                                        // The payment has been processed!
                                        if (result.paymentIntent.status === 'succeeded') {
                                            $("#loading").show();
                                            $("#payment_intent_id").val(result.paymentIntent.id);
                                            $("#form_success").submit();

                                        }
                                    }
                                });
                                /////////////


                            }
                            else
                            {
                                swal("Sorry!","Something went wrong.Please try again.",'warning');
                            }
                        },
                        error:function (data) {

                        }
                    });

                    /////////////////

                });

            </script>
            <script>
                $(document).ready(function() {

                    $.ajax({
                        url: "/vatpercentage",
                        method: "get",
                        dataType: "json",
                        success: function(data) {
                            if (data.success == true) {
                                console.log('vat');
                            }
                        }
                    });
                });

            </script>

        </div>
     </div>









            <div class="clearfix"></div>
        </div>

    </div>
</div>
<script>
    $(document).ready(function(){

        $("#loading").show();
    });
</script>






@endsection

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]