@mithrandir69 You need to know what the error is first before you can fix. So check your error log.
Oct 3, 2021
4
Level 1
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 ??
Please or to participate in this conversation.