Prerequisites
Before you can receive webhooks, you need:- You need a publicly accessible URL on your server, such as https://your-store.com/webhooks/tonder, that can receive POST requests. This cannot be a localhost URL.
For local testing, services like ngrok can create a public URL that forwards requests to your local machine.
Configuring and Listening for Webhooks
Follow these steps to register your endpoint, listen for events, acknowledge them, and verify their authenticity.Step 1: Register Your Endpoint in the Dashboard
Follow these steps to register your webhook endpoint:- Log in to your Tonder Dashboard.
- Navigate to Developers > Webhooks.
- Click Add Endpoint.
- Paste your public endpoint URL, such as https://your-store.com/webhooks/tonder, into the Endpoint URL field.
- Select the events you want to listen to, such as session.completed and session.expired.
- Click Save.
Step 2: Listen for POST Requests
Your endpoint must be configured to accept POST requests with a JSON body. When an event occurs, Tonder will send a request that looks like this:Step 3: Acknowledge the Event
To let Tonder know you’ve successfully received the webhook, your server must respond with a 200 OK HTTP status code. If Tonder does not receive a 200 OK response, it will assume the delivery failed and will retry sending the webhook. Respond immediately before running any complex business logic, such as updating your database, to avoid timeouts. This Node.js/Express example demonstrates how to set up a webhook endpoint that acknowledges receipt immediately and then processes the event:Step 4: Verify the Signature (Recommended)
To ensure the webhook request actually came from Tonder, you should verify its signature. Tonder includes a Tonder-Signature header in each webhook request.This step is critical for security. It prevents attackers from sending fake webhooks to your endpoint.
- Getting your Webhook Signing Secret from the Tonder Dashboard on the same page where you add your endpoint.
- Comparing the Tonder-Signature header with a signature you compute yourself using the request body and your secret.
See Also
For more information about webhooks and payment status handling:- Review the Webhook Events & Payloads reference for a full list of all webhook events and their JSON payloads.
- Learn how to manually check payment status as a fallback if you don’t use webhooks.

