#famoussonace
1 messages · Page 1 of 1 (latest)
I'm not familiar with laravel forge but you should have a server that is listening for requests right?
The Stripe CLI is simply listening for, and forwarding requests to the URL that you've defined
because chat gpt is telling me that I need to write in my controller
"$payload = $request->getContent();
$sigHeader = $request->header('Stripe-Signature');
$endpointSecret = config('services.stripe.webhook_secret');
try {
$event = Webhook::constructEvent(
$payload, $sigHeader, $endpointSecret
);
} catch (\Exception $e) {
return response()->json(['error' => 'Webhook signature verification failed.'], 403);
}"
which sounds absurd to me
and to sum up you suggest: that somewhere in the server I need to put my worker to listen this
"chat gpt answer:
Hey there! If you're using Laravel Forge to deploy your application, you might not be able to run the stripe listen command directly on the server since Forge is a managed hosting service and doesn't provide direct access to the command line."
If Forge is a managed hosting service and you already have a publicly accessible url, then you don't need to use the Stripe CLI for testing. You can always create a webhook endpoint defining your url there : https://stripe.com/docs/api/webhook_endpoints/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The URL you have now would only work in test mode though. In livemode, we require https
The reason why you would need the Stripe CLI for testing is that Stripe can't directly send a request to your local development environment. That's why you use the Stripe CLI to listen for webhooks and forward it on to your local application
but i've already have this in my routes
Route::stripeWebhooks('stripe/webhook');
which is some stripe endpoint, why then I need to create new webhook again?!
I though that the frontend just need to hit the stripeSession url?
that's your code to process the webhook. Stripe also needs to know where to send the webhooks to : https://stripe.com/docs/webhooks#register-webhook
So on each "stripe session" url hit,
you need firstly to connect to the webhook, then you handle the code with the stripe session, just like chatGpt said?
you need to register the URL that Stripe will send the events to. Stripe will send events to the URL that you defined, and your application / server will process those events according to the code you've implemented
I'd recommend reading through https://stripe.com/docs/webhooks
the example is confusing, because file_put_contents? you need to listening to webhook ulr, what are those file put contents?!
totally confusing, because now you not only listening to the webhook, but the same time, some file put contents and some events cases
can you write down for production all steps?!