I am creating a payment gateway using Stripe.
I want to set my localhost url localhost/stripe/webhook.php
as my webhook url. Is it possible to set a localho
It is possible to send the webhooks to your local host. Look up "ngrok", when you run that it opens up a port to public internet access and provides you with a url that can access your localhost from. take this url and set it as your webhook address and finish the url by pointing it at your webhook.php file.
* EDIT *
This is only appropriate for testing.
You can use expose.sh to expose your server using a public HTTPS URL.
For Mac or Linux, go to Expose.sh and copy/paste the installation code shown into a terminal.
For Windows go to Expose.sh, download the binary and put it somewhere in your PATH.
Start your API server. Then run expose <port>
where port is the port your API server is running on, like 80 or 8080.
Expose.sh will generate a random public expose.sh URL. You'll see output like
https://s3rh.expose.sh is forwarding to localhost:80
http://s3rh.expose.sh is forwarding to localhost:80
Then you can get Stripe to use the public HTTPS URL, which will forward to localhost. I've written a full guide here
Disclaimer: I built expose.sh
Stripe now has an official tool, the Stripe CLI that makes this easy (but still requires installing another tool).
See this answer below or the official Stripe CLI docs.
Alternatively, the another way to achieve this is with http://www.ultrahook.com which allows you to receive webhooks on localhost. This alternative will work with all webhooks, not just Stripe's