Skip to content

Webhooks

Receive signed events when conversions, commissions, payouts and affiliates change.

Events

conversion.created, conversion.refunded, commission.created, commission.approved, commission.rejected, commission.reversed, payout.paid, payout.failed, affiliate.applied, affiliate.approved, affiliate.suspended and test.ping.

Every delivery is a JSON POST:

{
  "id": "6f1c…",
  "type": "commission.created",
  "created": 1795000000,
  "data": { "commission_id": "…", "amount": 1490, "currency": "USD", "status": "pending" }
}

Headers: Affllux-Signature, Affllux-Event and Affllux-Delivery (unique per delivery — use it to ignore duplicates).

Verifying signatures

Affllux-Signature: t=<unix seconds>,v1=<hex> where v1 = HMAC-SHA256(secret, "<t>.<raw body>"). Compute it over the raw request body, compare in constant time and reject timestamps older than 5 minutes.

import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(rawBody: string, header: string, secret: string) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false;
  const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return expected.length === parts.v1?.length && timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
function afflux_verify(string $raw, string $header, string $secret): bool {
    parse_str(str_replace(',', '&', $header), $p);
    if (empty($p['t']) || abs(time() - (int) $p['t']) > 300) return false;
    $expected = hash_hmac('sha256', $p['t'] . '.' . $raw, $secret);
    return hash_equals($expected, $p['v1'] ?? '');
}
import hmac, hashlib, time

def verify(raw: bytes, header: str, secret: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    t = int(parts.get("t", 0))
    if abs(time.time() - t) > 300:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts.get("v1", ""))

Retries

Respond with any 2xx status within 10 seconds. Other responses, timeouts and connection errors are retried with exponential backoff starting at 30 seconds (30 s, 1 min, 2 min, 4 min …), up to 8 attempts. After the last attempt the delivery is marked failed, workspace members with integration permissions are notified, and you can retry it manually from Integrations → Webhooks. Endpoints must be publicly reachable HTTPS URLs; private network addresses are refused.