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

alex32's avatar
Level 2

Cashier webhook | URL not public?

I've installed Stripe on my live server and I'm able to see the transaction in Stripe-dahboard. But when I try to install Stripe-webhook I'm getting an error message saying my url is not public. As a result, the tables subscriptions don't get updated via StripeWebhookController.php

I followed Laravel's doc to install Cashier [2] - I didn't install stripe-php like I did for laravel 10

Please help. Many thanks

  • Laravel 11
  • Stripe: latest (2024-04-10)
  • Ubuntu 22.04
cd /home/example.com/../laravel
php artisan cashier:webhook  

Stripe\Exception\InvalidRequestException 
Invalid URL: URL must be publicly accessible. 

cURL is installed:

curl --help
Usage: curl [options...] <url>
 -d, --data <data>          HTTP POST data
 -f, --fail                 Fail silently (no output at all) on HTTP errors
 -h, --help <category>      Get help for commands
 

laravel.log:

{"exception":"[object] (Stripe\Exception\InvalidRequestException(code: 0): Invalid URL: URL must be publicly accessible. .. 
/home/bob32/web/example.com/public_html/laravel/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php:38)
...

.env

    STRIPE_KEY= xxxx
    STRIPE_SECRET= xxxx
    STRIPE_WEBHOOK_SECRET= xxxx 

web.php

Route::post('/stripe/webhook', 'App\Http\Controllers\StripeWebhookController@handleWebhook')->name('cashier.webhook')->withoutMiddleware(\App\Http\Middleware\VerifyCsrfToken::class); 

[1] https://laracasts.com/discuss/channels/laravel/troubleshooting-stripe-webhook-setup-in-laravel-10-invalid-url-exception

[2] https://laravel.com/docs/11.x/billing#installation

0 likes
4 replies
MohamedTammam's avatar

Look at your APP_URL in your .env and update it correctly and then run php artisan config:clear

alex32's avatar
Level 2

Thanks for your feedback. I fixed APP_URL but Stripe webhook still doesn't work.

scrshot

alex32's avatar
Level 2

Thanks for your reply, finally the Webhook started working and data is getting saved to subscription tables.

But now , in Stripe's Dashboard, I get 403 (forbidden). I suppose this is a chmod or chown issue, do you know which folders do I need to check? Many thanks

laravel.log: no errors

Stripe Dashboard | Response: HTTP status code 403 (forbidden)

Please or to participate in this conversation.