Lemon Squeezy Webhooks
Laratic is already configured to handle Lemon Squeezy webhooks. You just need to set up the webhook in your Lemon Squeezy dashboard.
Configure Webhook in Lemon Squeezy Dashboard (For Production)
- Navigate to Settings > Webhooks in your Lemon Squeezy dashboard.
- Click Create Webhook.
- Enter your webhook URL:
- Production:
https://your-domain.com/lemon-squeezy/webhook - Local testing: Use ngrok (see below) to expose your local server
- Production:
- Select the events you want to receive, you can choose all of them.
- Save the webhook configuration.
Testing Locally with ngrok
Note: You need an ngrok account to use ngrok. Sign up for a free account at ngrok.com if you don't have one.
Important
If you're using Laravel Debugbar, disable it before testing webhooks as it will
exhaust your memory when webhooks are received.
Free ngrok accounts can only have one active tunnel, so kill
all ngrok processes (pkill ngrok) before starting a new one.
- Start your Laravel application locally, make sure it's running on port 8000:
php artisan serve - In a separate terminal, start ngrok to expose your local server (use the URL from the
php artisan servecommand):
If your app is running on a different port, you can specify the port with thephp artisan lmsqueezy:listen ngrok--portoption:php artisan lmsqueezy:listen ngrok --port=8001 - This should automatically add the webhook URL to the Lemon Squeezy webhook configuration in the Lemon
Squeezy dashboard. Go there and get the webhook secret and add it to your .env file.
LEMON_SQUEEZY_SIGNING_SECRET=add the webhook secret here
The webhook endpoint is already configured in bootstrap/app.php and excluded from CSRF
protection.
The LemonSqueezyEventListener automatically handles webhook events.
To learn more about the webhook events, see the Lemon Squeezy Laravel package documentation.