zendfi webhooks
zendfi listen
Options
| Flag | Description | Default |
|---|---|---|
--port <port> | Local port to listen on | 3000 |
--forward-to <url> | Forward received webhooks to another local URL | — |
How It Works
Start local server
The CLI starts an Express server on the specified port (default 3000) with two endpoints:
| Endpoint | Method | Purpose |
|---|---|---|
/webhooks | POST | Receives webhook events from ZendFi |
/health | GET | Health check returning { status: "ok", webhooksReceived: N } |
Detect tunnel service
The CLI checks for
ngrok and cloudflared on your system. If both are available, it prompts you to choose. If neither is installed, it shows installation links:- ngrok: ngrok.com/download
- cloudflared: Cloudflare Tunnel docs
Create tunnel
Launches the selected tunnel service pointing to your local port. The CLI waits up to 30 seconds for the tunnel URL to become available.
Forwarding
Use--forward-to to relay webhook payloads to your application’s actual webhook endpoint. This lets you test your real webhook handler while still seeing events in the CLI:
localhost:3000/api/webhooks/zendfi.
Tunnel Services
ngrok
The most popular option. The CLI reads the tunnel URL from ngrok’s stdout output. Free tier supports one tunnel at a time.Cloudflare Tunnel (cloudflared)
Free, no-signup alternative. Creates a*.trycloudflare.com URL automatically.
Shutdown
PressCtrl+C to gracefully shut down. The CLI closes the local server, kills the tunnel process, and shows the total number of webhooks received during the session.
Testing Workflow
A typical local webhook testing session:payment.created and payment.confirmed webhooks. The CLI logs them, forwards them to your app, and your webhook handler processes them as it would in production.