Webhooks + Local environment does not work
luissandrea opened this issue · 6 comments
How do you handle webhooks in local environment?. Out of ignorance, I had never used webhooks like this.
Therefore, return responses will never fall and fire in the local environment.
(ngrok is not and option for free temp plan)
Hi @luissandrea. Was the https://github.com/lmsqueezy/laravel#webhooks section in the docs not clear about this? What are you missing from these docs to get started?
@luissandrea depending on what you're using to run Laravel locally, you might already have an easy way to do this baked in:
- Using Valet:
# set sharing tool to either ngrok or expose
valet share-tool ngrok
valet share-tool expose
# create public url
valet share
see https://laravel.com/docs/valet#sharing-sites
- Using Sail:
# create public url with expose
sail share
see https://laravel.com/docs/sail#sharing-your-site
@driesvints it might be a good idea to link directly to the 'Laravel way' of sharing sites (Valet & Sail) in the docs. Right now some people might think it's much more complicated than it actually is
Thank you @felixsc. Gonna wait on @luissandrea' answer.
Hey @felixsc, based on my understanding, ngrok implements a lock screen feature in its free plan. Consequently, would the application remain unaffected by this lock?. (Typically, I haven't had to expose an app for this particular scenario)
Likewise, I will follow your instructions and provide feedback accordingly. 😉
I'm not sure what you mean by lock screen, could you explain that to me?
In general, what these tools will do is give you a public URL with a random subdomain where your project will be accessible from the public. This URL will be alive as long as you're running the tool in your command line. You then add this public URL as the webhook URL in Lemon Squeezy. So, any time you test a purchase on LS it will send the webhook to this URL, which behind the scenes gets routed to your local dev environment.
One difference between the free and paid plans is that on the free plans, you'll get a new random subdomain every time you run it. So you'll have to change the webhook URL each time. With the paid plans you'll get a fixed domain (or you can add a custom one) so you don't have to worry about changing the webhook each time.
Does that help?
Added an extra note about Sail and Valet in the docs: 00be4a4
Thanks