Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mithrandir69's avatar

ERROR 500 Stripe Webhook when payment_intent.created on Laravel

I'm trying the cmd commands to listen the Stripe webhooks (https://stripe.com/docs/webhooks/test). https://i.stack.imgur.com/1X5NB.png

this is the route web.php:

use Illuminate\Http\Request;
Route::post('webhook/payment/succeeded', function (Request $request){
    if($request->type === "payment_intent.created"){
        try{
Payment::create([
    'stripe_id' => $request->data['object']['id'],
    'amount' => $request->data['object']['amount'],
]);
        } catch (\Exception $e) {
            return $e->getMessage();
        }
    }
    return 'ok';
});

this is the Payment.php :

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Payment extends Model
{
    use HasFactory;
    protected $guarded = [];

}

So please how to fix that ??

0 likes
4 replies
martinbean's avatar

@Mithrandir69 What do you mean? The error log is just a file at storage/logs/laravel.log. Just like any Laravel application.

Open it and read it. The exception that caused the 500 error will have been written there.

1 like
Mithrandir69's avatar

@martinbean thank u sir , I forgot to add use App\Models\Payment; to the route ;P that was stupid but thank u anyways !

1 like

Please or to participate in this conversation.