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

Trupen's avatar

Troubleshooting Stripe Webhook Setup in Laravel 10: Invalid URL Exception

When running php artisan cashier:webhook in Laravel 10 on my Ubuntu 22.04.3 LTS local environment, I encounter the Stripe\Exception\InvalidRequestException with the message "Invalid URL: URL must be publicly accessible." How can I resolve this issue and successfully set up my Stripe webhook locally for testing?

I am following: laravel.com/docs/10.x/billing#handling-stripe-webhooks

1 like
3 replies
martinbean's avatar

@trupen Well what’s the URL you’re trying to use? As the error is telling you it’s not publicly accessible, so sounds like you’re trying to use localhost or something.

Trupen's avatar

@martinbean I am trying to integrate Laravel 10 Cashier (Stripe), And the document says:

Cashier includes the cashier:webhook Artisan command. This command will create a webhook in Stripe that listens to all the events required by the cashier: php artisan cashier: webhook

So I'm trying to run this command in my local console and I get this error with the message:

Stripe\Exception\InvalidRequestException

Invalid URL: URL must be publicly accessible. Consider using a tool like Stripe CLI to test webhooks locally: github.com/stripe/stripe-cli

By default, the created webhook will point to localhost/example/stripe/webhook

Snapey's avatar
Snapey
Best Answer
Level 122

@Trupen So the answer is literally there.

Consider using a tool like Stripe CLI to test webhooks locally: github.com/stripe/stripe-cli

stripe-cli listens for and then forwards webhooks from stripe to your private network. Stripe cannot call your webhook endpoint if it is on a private network.

You can use a tool like Ngrok or Expose to create a tunnel to your local machine, but the CLI tool is easier to use and shows you additional diagnostic information.

Please or to participate in this conversation.