Laravel 5.7 Stripe Payment Gateway Example From Scratch

Today, We want to share with you Laravel 5.7 Stripe Payment Gateway Example From Scratch.In this post we will show you Stripe Payment Gateway Integration using Laravel 5.7, hear for Laravel 5.7 – Stripe Payment Gateway Integration Example we will give you demo and example for implement.In this post, we will learn about Laravel Stripe Payment Gateway Integration Tutorial with an example.

Laravel 5.7 Stripe Payment Gateway Example From Scratch

There are the Following The simple About Laravel 5.7 Stripe Payment Gateway Example From Scratch Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to integrate Stripe payment gateway in laravel 5.7, so the Integrate Laravel Stripe Gateway for Online Payments for this example is following below.

Phase 1: Install Laravel 5.7

composer create-project --prefer-dist laravel/laravel atmiya25

Phase 2: Install stripe-php Package

install stripe-php via the Composer package manager

composer require stripe/stripe-php

Phase 3: Set Stripe API Key and SECRET

.env files

STRIPE_KEY=pk_test_reFxwb98Js58diDf25TfxAR
STRIPE_SECRET=sk_test_oJSkdui85dJiPd4wDJsui5pY

Phase 4: Define a Laravel Routes

routes/api.php

name('stripe.post');

Phase 5: Create Controller File

app/Http/Controllers/CkPaymentStripeController.php

 100 * 100,
                "currency" => "usd",
                "source" => $request->liveTokenStripe,
                "description" => "Test payment from pakainfo.com." 
        ]);
  
        Session::flash('success', 'Your Payment successful!');
          
        return back();
    }
}

Phase 6: Make a Laravel Blade File

resources/views/stripe.blade.php




	Laravel 5.7 Stripe Payment Gateway Example From Scratch - pakainfo.com
	
    
    
        .panel-title {
        display: inline;
        font-weight: bold;
        }
        .display-table {
            display: table;
        }
        .display-tr {
            display: table-row;
        }
        .display-td {
            display: table-cell;
            vertical-align: middle;
            width: 61%;
        }
    


  

Laravel 5 - Stripe Payment Gateway Integration Example
pakainfo.com

Laravel 5.7 Stripe Payment Gateway Example From Scratch

Your Payment Details

Laravel 5.7 Stripe Payment Gateway Example
@if (Session::has('success'))
×

{{ Session::get('success') }}

@endif
@csrf
Please Your correct the errors and try again.
$(function() { var $liveFrm = $(".require-validation"); $('form.require-validation').bind('submit', function(e) { var $liveFrm = $(".require-validation"), inputSelector = ['input[type=email]', 'input[type=password]', 'input[type=text]', 'input[type=file]', 'textarea'].join(', '), $inputs = $liveFrm.find('.required').find(inputSelector), $errorMessage = $liveFrm.find('div.error'), valid = true; $errorMessage.addClass('hide'); $('.has-error').removeClass('has-error'); $inputs.each(function(i, el) { var $input = $(el); if ($input.val() === '') { $input.parent().addClass('has-error'); $errorMessage.removeClass('hide'); e.preventDefault(); } }); if (!$liveFrm.data('cc-on-file')) { e.preventDefault(); Stripe.setPublishableKey($liveFrm.data('stripe-publishable-key')); Stripe.createToken({ number: $('.card-number').val(), cvc: $('.card-cvc').val(), exp_month: $('.card-expiry-month').val(), exp_year: $('.card-expiry-year').val() }, stripeResponseHandler); } }); function stripeResponseHandler(status, response) { if (response.error) { $('.error') .removeClass('hide') .find('.alert') .text(response.error.message); } else { var token = response['id']; $liveFrm.find('input[type=text]').empty(); $liveFrm.append(""); $liveFrm.get(0).submit(); } } });

Now We can check or testing purpose with following card Info:

//Testing Details
Your Name: Jaydeep Gondaliya
Number: 4242 4242 4242 4242
CSV: 715
Expiration Month: 12
Expiration Year: 2029
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel 5.7 Stripe Payment Gateway Example From Scratch.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment