![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mcoil.corals.io/resources/views/front/payments/ |
<tr> <td> @if(isset($payment['name'])) <form action="{{ route('checkout.execute') }}" method="post" class="pull-right" id="stripeForm"> <input type="hidden" name="payment" value="{{ config('stripe.name') }}"> <input type="hidden" name="stripeToken" value=""> <input type="hidden" class="billing_address" name="billing_address" value=""> <input type="hidden" class="delivery_address_id" name="delivery_address" value=""> <input type="hidden" class="courier" name="courier" value=""> <input type="hidden" class="order_id" name="order_id" value="{{ $orderDetails->id ?? '' }}"> <input type="hidden" class="discount_coupon" name="discount_coupon" value="{{ $discountCoupon }}"> <input type="hidden" class="discount_type" name="discount_type" value="{{ $discountType }}"> <input type="hidden" class="discount_value" name="discount_value" value="{{ $discountValue }}"> <input type="hidden" class="discount_amount" name="discount_amount" value="{{ $discountAmount }}"> <input type="hidden" name="delivery_note" id="delivery_note" value=""> {{ csrf_field() }} <button id="paywithstripe" class="btn btn-primary">Pay with {{ ucwords($payment['name']) }} <i class="fa fa-cc-stripe"></i></button> </form> @endif </td> </tr> <script src="{{ url('https://checkout.stripe.com/checkout.js') }}"></script> <script type="text/javascript"> $(document).ready(function () { // To set the initial values rquired for payment let billingAddressId = $('input[name="billing_address"]:checked').val(); $('.billing_address').val(billingAddressId); $('.delivery_address_id').val(billingAddressId); $('input[name="billing_address"]').on('change', function () { billingAddressId = $('input[name="billing_address"]:checked').val(); $('.billing_address').val(billingAddressId); }); let courierRadioBtn = $('input[name="rate"]'); courierRadioBtn.click(function () { $('.rate').val($(this).val()) }); // Stripe payment code let handler = StripeCheckout.configure({ key: "{{ config('stripe.key') }}", locale: 'auto', token: function(token) { // You can access the token ID with `token.id`. // Get the token ID to your server-side code for use. // console.log(token.id); $('input[name="stripeToken"]').val(token.id); $('#stripeForm').submit(); } }); document.getElementById('paywithstripe').addEventListener('click', function(e) { let total = parseFloat("{{ $total + $tax }}"); let shipping = parseFloat($('#shippingFeeC').val()); let amount = total; if (!isNaN( shipping)) { let amount = total + shipping; } // Deduct the discount (If any) var discount = '{{ $discountAmount }}'; if (discount != 0) { amount = amount - discount; } // Open Checkout with further options: handler.open({ name: "{{ config('stripe.name') }}", description: "{{ config('stripe.description') }}", currency: "{{ config('cart.currency') }}", amount: amount * 100, email: "{{ $customer->email }}" }); e.preventDefault(); }); // Close Checkout on page navigation: window.addEventListener('popstate', function() { handler.close(); }); }); </script>