Overview
During development, your local server is not accessible from the internet. To receive Yuno webhook events locally, you need a tunneling tool that exposes your local server to a public URL. This guide covers setup, debugging, and best practices for local webhook testing.Setting Up ngrok
ngrok creates a secure tunnel from a public URL to your local machine. Other alternatives include Cloudflare Tunnel and localtunnel.Install and configure ngrok
Start the tunnel
Point ngrok at the port your local server runs on:https://abc123.ngrok-free.app. This is your webhook endpoint URL.
Register the tunnel URL in Yuno Dashboard
- Go to Dashboard > Settings > Webhooks
- Click Add Endpoint (or edit an existing endpoint)
- Set the URL to your ngrok URL plus your webhook path:
- Select the events you want to receive (e.g.,
payment.succeeded,refund.created) - Click Save
Sending Test Events from the Dashboard
Yuno Dashboard allows you to send test webhook events without creating real transactions:- Navigate to Dashboard > Settings > Webhooks
- Click on your configured endpoint
- Click Send Test Event
- Select the event type (e.g.,
payment.succeeded) - Click Send
http://localhost:4040 for details.
Debugging Failed Webhook Deliveries
Check the ngrok inspector
ngrok provides a web inspector athttp://localhost:4040 that shows:
- All incoming HTTP requests
- Request headers and body
- Response status codes and body
- Timing information
Common delivery failures
Enable verbose logging
Add request logging to your webhook handler during development:Yuno retry behavior
When your endpoint returns a non-2xx status code or times out, Yuno retries the delivery:
After 5 failed retries, the event is marked as failed. You can manually retry failed events from Dashboard > Settings > Webhooks > Failed Deliveries.
Your endpoint must respond within 15 seconds. If your processing takes longer, return 200 immediately and handle the event asynchronously using a message queue or background job.
Idempotent Event Handling
Yuno may deliver the same event more than once (due to retries or at-least-once delivery). Your handler must be idempotent to prevent duplicate processing.Pattern: Track processed event IDs
Production recommendations
- Store processed event IDs in a persistent store (Redis, database) with a TTL of 7 days
- Use database transactions to ensure event processing and ID recording are atomic
- Design your event handlers to be safe to run multiple times (e.g., use upserts instead of inserts)
Monitoring Webhooks
Health check endpoint
Add a health check endpoint alongside your webhook handler to verify your server is reachable:Structured logging for production
Log webhook events in a structured format for easier debugging and monitoring:Local Testing Checklist
- Tunneling tool (ngrok) installed and running
- Webhook URL registered in Yuno Dashboard with correct path
- Webhook signing secret stored as environment variable
- Signature verification implemented and tested
- Timestamp validation implemented (5-minute tolerance)
- Idempotent event handling in place
- Handler responds within 15 seconds
- Test events sent successfully from Dashboard
- Error cases handled (invalid signature, unknown event types)