Paddle Webhooks & Testing
Configure webhooks in Paddle to receive events and keep your local database in sync. This guide walks you through setting up webhooks in the Paddle sandbox and testing them locally.
1. Set Up Webhook in Paddle Sandbox
To configure webhooks in the Paddle sandbox dashboard:
- Navigate to Developer Tools > Notifications in your Paddle sandbox dashboard.
- Click New Destination to create a new webhook destination.
- Enter your webhook URL. For local testing, you'll use an ngrok URL (see step 3 below).
- Enable the following events:
- All of the
subscriptionevents price.createdprice.updatedtransaction.completedtransaction.updatedcustomer.updated
- All of the
- Copy the Webhook Secret that Paddle generates. You'll need this for your
.envfile.
2. Add Webhook Secret to Environment
Add the webhook secret to your .env file:
PADDLE_WEBHOOK_SECRET=your_webhook_secret_from_paddle
PADDLE_SANDBOX=true # For sandbox make sure you have this in env
After adding the secret, clear and cache your configuration:
php artisan config:clear
php artisan config:cache
3. Test with ngrok (Requires Account)
Note: You need an ngrok account to use ngrok. Sign up for a free account at ngrok.com if you don't have one.
- Start your Laravel application locally:
php artisan serve - In a separate terminal, start ngrok to expose your local server (use the URL from the
php artisan servecommand):ngrok http http://127.0.0.1:8000 - Copy the HTTPS URL that ngrok provides (e.g.,
https://abc123.ngrok-free.app). and add/paddle/webhookto the end of the URL.
Add this URL to the Paddle Webhook destination in the Paddle dashboard.https://your-ngrok-url.ngrok-free.app/paddle/webhook
Webhook Endpoint
Laratic has already added the paddle endpoint to bootstrap/app.php for you. This will exclude the webhook from CSRF protection. You can update this in the app.php file.
$middleware->validateCsrfTokens(except: [
'paddle/*',
]);
4. Test with a Product
To verify webhooks are working:
- Create a test product in the Paddle sandbox dashboard.
- Add a price to the product. This will trigger a
price.createdwebhook. - Check your Laravel logs to see if the webhook was received, you can also check your database or products page to see if the product was created.
- Paddle also provides webhook logs to help you debug any issues.
If you see log entries like "New product created from Paddle webhook" in your Laravel logs, and the webhook shows as successful in the Paddle dashboard, your webhook setup is working correctly!