Laravel 8 Stripe PaymentGatewayの統合例


Stripeは2011年に設立され 、マーチャントアカウントと支払い処理業者の間で送金することにより、クレジットカードによる支払いを(直接またはオンラインで)受け入れることができる支払いゲートウェイです。これは、物理的なクレジットカード端末またはオンラインプロセッサを使用して行われます



  • ステップ1:Laravel8アプリをインストールする
  • ステップ2:ストライプパッケージをインストールする
  • ステップ3:ストライプ構成
  • ステップ4:ルートを作成する
  • ステップ5:コントローラーを作成する
  • ステップ6:ブレードビューファイルを作成する
  • ステップ7:開発サーバーを実行する



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



composer require stripe/stripe-php

その後、ストライプキーとシークレットを設定する必要があります。したがって、  Stripe  Webサイトにアクセスして、開発ストライプアカウントを作成します。そして、stripe.comから鍵と秘密を入手してください。




次のステップでは、Stripe APIキーを設定する必要があります。これを行うには、config/services.php ファイルを開くか作成し 、'stripe' 配列を追加または更新し ます。

'stripe' => [
     'secret' => env('STRIPE_SECRET'),



use Illuminate\Support\Facades\Route;
use App\Http\Controllers\StripeController;
| Web Routes
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
Route::get('stripe', [StripeController::class, 'stripe']);
Route::post('stripe', [StripeController::class, 'stripePost'])->name('');



php artisan make:controller StripeController

次に、app / Http / Controllers /ディレクトリにアクセスして、StripeControllerを開きます。次に、次のコードをStripeController.phpに追加します

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Session;
use Stripe;
class StripeController extends Controller
     * success response method.
     * @return \Illuminate\Http\Response
    public function stripe()
        return view('stripe');
     * success response method.
     * @return \Illuminate\Http\Response
    public function stripePost(Request $request)
        Stripe\Charge::create ([
                "amount" => 100 * 100,
                "currency" => "usd",
                "source" => $request->stripeToken,
                "description" => "Test payment from"
        Session::flash('success', 'Payment successful!');
        return back();


このステップでは、app / resources / views /にアクセスして、1つのブレードビューファイル名stripe.blade.phpを作成します次に、次のコードをStripe.blade.phpファイルに追加します。

<!DOCTYPE html>
<title>Laravel 8 - Stripe Payment Gateway Integration Tutorial Example -</title>
<link rel="stylesheet" href="">
<script src=""></script>
<style type="text/css">
.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%;
<div class="container">
<h1>Laravel 8 - Stripe Payment Gateway Integration Example <br/></h1>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-default credit-card-box">
<div class="panel-heading display-table" >
<div class="row display-tr" >
<h3 class="panel-title display-td" >Payment Details</h3>
<div class="display-td" >                            
<img class="img-responsive pull-right" src="">
<div class="panel-body">
@if (Session::has('success'))
<div class="alert alert-success text-center">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<p>{{ Session::get('success') }}</p>
action="{{ route('') }}"
data-stripe-publishable-key="{{ env('STRIPE_KEY') }}"
<div class='form-row row'>
<div class='col-xs-12 form-group required'>
<label class='control-label'>Name on Card</label> <input
class='form-control' size='4' type='text'>
<div class='form-row row'>
<div class='col-xs-12 form-group card required'>
<label class='control-label'>Card Number</label> <input
autocomplete='off' class='form-control card-number' size='20'
<div class='form-row row'>
<div class='col-xs-12 col-md-4 form-group cvc required'>
<label class='control-label'>CVC</label> <input autocomplete='off'
class='form-control card-cvc' placeholder='ex. 311' size='4'
<div class='col-xs-12 col-md-4 form-group expiration required'>
<label class='control-label'>Expiration Month</label> <input
class='form-control card-expiry-month' placeholder='MM' size='2'
<div class='col-xs-12 col-md-4 form-group expiration required'>
<label class='control-label'>Expiration Year</label> <input
class='form-control card-expiry-year' placeholder='YYYY' size='4'
<div class='form-row row'>
<div class='col-md-12 error form-group hide'>
<div class='alert-danger alert'>Please correct the errors and try
<div class="row">
<div class="col-xs-12">
<button class="btn btn-primary btn-lg btn-block" type="submit">Pay Now ($100)</button>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
$(function() {
var $form         = $(".require-validation");
$('form.require-validation').bind('submit', function(e) {
var $form         = $(".require-validation"),
inputSelector = ['input[type=email]', 'input[type=password]',
'input[type=text]', 'input[type=file]',
'textarea'].join(', '),
$inputs       = $form.find('.required').find(inputSelector),
$errorMessage = $form.find('div.error'),
valid         = true;
$inputs.each(function(i, el) {
var $input = $(el);
if ($input.val() === '') {
if (!$'cc-on-file')) {
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) {
} else {
/* token contains id, last4, and card type */
var token = response['id'];
$form.append("<input type='hidden' name='stripeToken' value='" + token + "'/>");


このステップでは、ターミナルでPHP artisanserveコマンドを実行して開発サーバーを起動します。

php artisan serve

If you want to run the project diffrent port so use this below command 

php artisan serve --port=8080


http:// localhost:8000 / strippe


 Card No : 4242424242424242
 Month : any future month
 Year : any future Year
 CVV : 123


laravel 8チュートリアルでのストライプ支払いゲートウェイの統合、laravel8アプリでストライプ支払いゲートウェイを統合する方法を学びました。



What is GEEK

Buddha Community

Laravel 8 Stripe PaymentGatewayの統合例

I am Developer


Laravel 8 Tutorial for Beginners

Hello everyone! I just updated this tutorial for Laravel 8. In this tutorial, we’ll go through the basics of the Laravel framework by building a simple blogging system. Note that this tutorial is only for beginners who are interested in web development but don’t know where to start. Check it out if you are interested: Laravel Tutorial For Beginners

Laravel is a very powerful framework that follows the MVC structure. It is designed for web developers who need a simple, elegant yet powerful toolkit to build a fully-featured website.

Recommended:-Laravel Try Catch

#laravel 8 tutorial #laravel 8 tutorial crud #laravel 8 tutorial point #laravel 8 auth tutorial #laravel 8 project example #laravel 8 tutorial for beginners

I am Developer


Laravel 8 New Features | Release Notes - Tuts Make

In this post, i will show you what’s new in laravel 8 version.

#What’s new in Laravel 8?

  • 1 - Change Path Of Default Models Directory
  • 2 - Removed Controllers Namespace Prefix
  • 3 - Enhancements on php artisan serve
  • 4 - Enhanced Rate Limiting
  • 5 - Enhanced on Route Caching
  • 6 - Update on Pagination Design
  • 8 - Dynamic Blade Componenets
  • 7 - Update Syntax for Closure Based Event Listeners
  • 8 - Queueable Model Event Listeners
  • 9 - Maintenance mode: secret access
  • 10 - Maintenance mode: pre-rendered page
  • 11 - Queued job batching
  • 12 - Queue backoff()
  • 13 - Laravel Factory

#laravel 8 features #laravel 8 release date #laravel 8 tutorial #news - laravel 8 new features #what's new in laravel 8 #laravel 8 release notes

Stripe Payment Gateway Integration Example In Laravel 8

In this post i will share you stripe payment gateway integration example in laravel 8, stripe payment gateway is integrated in many website for payment collection from client, In this time many e-commerce website and other shopping websites are use stripe payment gateway.

So, here we will learn stripe payment gateway integration in laravel 8.

Read More : Stripe Payment Gateway Integration Example In Laravel 8

Read Also : How To Integrate Paypal Payment Gateway In Laravel

#stripe payment gateway integration example in laravel 8 #laravel 8 stripe payment gateway integration example #stripe payment gateway integration in laravel 8 #stripe payment gateway #laravel8 #payment gateway

I am Developer


Laravel 8 Tutorial For Beginners Step by Step

Recommended:- Laravel Try Catch

#laravel #laravel 8 tutoral #laravel 8 tutorial for beginners #laravel 8 tutorial for beginners step by step #laravel 8 tutorial from scratch

Yogi Gurjar


Laravel 8 Form Validation Tutorial

Laravel 8 form validation example. In this tutorial, i will show you how to submit form with validation in laravel 8.

And you will learn how to store form data in laravel 8. Also validate form data before store to db.

How to Validate Form Data in Laravel 8

  1. Step 1 – Install Laravel 8 Application
  2. Step 2 – Configuring Database using Env File
  3. Step 3 – Create Model & Migration File For Form
  4. Step 4 – Create Routes
  5. Step 5 – Creating Controller
  6. Step 6 – Create Blade File For Form
  7. Step 7 – Start Development Server
  8. Step 8 – Run Laravel 8 Form Validation App On Browser

#laravel 8 form validation #laravel 8 form validation tutorial #laravel 8 form validation - google search #how to validate form data in laravel 8 #form validation in laravel 8