Skip to main content

What are Webhooks?

Webhooks allow you to receive real-time HTTP notifications when events occur in your Affonso affiliate program. Instead of polling our API for changes, webhooks push data to your server the moment something happens.

How Webhooks Work

  1. Event occurs - An affiliate signs up, a referral converts, a commission is paid, etc.
  2. Affonso sends a POST request - We send a JSON payload to your configured endpoint
  3. Your server processes the event - Handle the data as needed
  4. Respond with 200 OK - Confirm receipt of the webhook

Event Categories

Affiliate Events

Track when affiliates sign up, get approved, or update their details

Referral Events

Monitor referral clicks, leads, and conversions

Transaction Events

Get notified about sales and commissions. Refunds are not a separate event: a full refund arrives as transaction.rejected, a partial refund as transaction.updated.

Payout Events

Track affiliate payouts and payment status

Security

All webhook requests include two headers for verification:
Affonso signs the string {timestamp}.{rawBody} with HMAC-SHA256 using your endpoint secret and sends the lowercase hex digest, without any prefix, in X-Affonso-Signature. The timestamp is sent in X-Affonso-Timestamp. Reject requests older than 5 minutes. See Webhook Setup for verification examples.

Retry Policy

If your endpoint returns a non-2xx status code or does not respond within 10 seconds, the delivery is treated as failed. Affonso retries with exponential backoff for up to 48 hours, 11 attempts total. After that, the delivery is marked as failed.

Payload Structure

All webhook payloads follow a consistent structure:

Next Steps

Set Up Webhooks

Configure webhook endpoints in your dashboard

Code Examples

Implementation examples in various languages