Skip to main content
The webhooks command starts a local server and creates a public tunnel so ZendFi can deliver webhook events to your machine during development.

zendfi webhooks

Aliases: zendfi listen

Options

How It Works

1

Start local server

The CLI starts an Express server on the specified port (default 3000) with two endpoints:
2

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:
3

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.
4

Display configuration

Shows the public webhook URL and setup instructions:
5

Log incoming events

Each webhook event is logged with a timestamp, event counter, event type, payment ID, status, and amount:

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:
The CLI receives the webhook on port 4000, logs it, and then forwards the full payload to your app at 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

Press Ctrl+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:
This creates a payment, which triggers 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.