#famoussonace

1 messages · Page 1 of 1 (latest)

ashen canopyBOT
cursive ingot
#

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

versed sun
#

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

"http://backedn-api.test/stripe/webhook"

#

"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."

cursive ingot
#

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

versed sun
#

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?

cursive ingot
versed sun
#

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?

cursive ingot
#

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

versed sun
#

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?!