Testing Webhooks (CLI)#
Webhooks let you receive real-time notifications from GoCardless when things happen in your merchant's account.
You can use the gocardless CLI to test your webhook integration locally. Each event from GoCardless contains an Event object with a link to the modified resource. The CLI can trigger these events and either print them to the console or forward them to your local webhook handler.
Listen for events#
Trigger an event#
In a separate terminal tab, use the trigger command to fire a mock webhook:
You'll see the event payload in your listen tab:
Forward events to your webhook handler#
Use the --forward flag to pipe events to a running webhook server:
Events will be forwarded to your webhook URL. Make sure your handler performs all the recommended checks when processing incoming webhooks.