Skip to main content
This guide walks you through setting up a webhook endpoint to receive events from Fungies.

Quick Start

1

Create endpoint handler

Build an HTTP endpoint that accepts POST requests
2

Register in Dashboard

Add your endpoint URL in the Fungies Dashboard
3

Verify signatures

Validate that requests are from Fungies

1. Create Your Endpoint Handler

Your webhook endpoint needs to:
  • Accept POST requests with a JSON body
  • Return a 2xx status code quickly (before any heavy processing)
  • Handle the Event object payload
Return your 2xx response immediately, then process the event asynchronously. This prevents timeouts on long-running operations.

Basic Handler Example

2. Register in the Fungies Dashboard

Once your endpoint is ready (or you’re using a tool like ngrok for local development):
  1. Go to Fungies DashboardDevelopersWebhooks
  2. Click Create a webhook
  3. Configure your webhook:
  1. Click Save
You can create multiple webhooks for different event types, or use a single endpoint that handles all events.
For subscription products, include payment_success if your handler fulfills orders. subscription_created alone is not enough — see Subscription checkouts and fulfillment.

3. Verify Webhook Signatures

Never skip signature verification in production. Without it, anyone could send fake events to your endpoint.
Fungies signs every webhook payload using HMAC-SHA256 with your webhook secret. The signature is included in the x-fngs-signature header:

How to Verify

  1. Get the raw request body (before any JSON parsing)
  2. Compute HMAC-SHA256 using your webhook secret
  3. Compare with the signature in the header

Verification Function

Express Middleware Example

Common Patterns

Idempotent Event Handling

Since webhooks guarantee at-least-once delivery, your handler might receive the same event multiple times. Use the event ID to prevent duplicate processing:

Async Processing with Queues

For complex operations, queue events for background processing:

Troubleshooting

Next Steps

Test Your Webhooks

Learn how to test webhooks locally before deploying to production