Share this article
Tracking & Analytics

Postback Security: Protecting Your S2S Endpoints From Fake Conversions

An open postback URL can be abused to fake conversions. Learn five layers of defence and see a short code example.

Anupam Kumar
Anupam Kumar
October 2, 20264 min read0 views
AdvancedUpdated December 3, 2026
Five layers of security in front of an S2S postback endpoint

A postback endpoint records conversions when called, so anyone who learns the URL can try to fake them. Protect it with layers: signed tokens, IP allowlists, click ID validation, rate limits and replay protection. No single check is enough, but together they make fake conversions hard and easy to detect.

Key takeaways

  • Treat the postback URL as a public API that triggers payment.
  • Never rely on secrecy of the URL alone.
  • Verify who is calling, what they are reporting and whether it has happened before.
  • Log every request, accepted or rejected.
  • New to postbacks? Read What Is a Postback URL? first, then harden.

Why are postbacks a target?

A basic postback looks like https://tracker.example.com/postback?click_id=ABC123&payout=5. If the URL is guessable or leaks through a screenshot, support ticket or browser history, a fraudster can call it repeatedly with real or invented click IDs and collect payouts. Fraud of this kind is one variety covered in Affiliate Fraud Types.

The five layers of defence

  1. Signed tokens: the advertiser's server includes a signature computed with a shared secret over the request values. The tracker recomputes and compares it. Without the secret, a caller cannot produce a valid request, and any change to the values breaks the signature.
  2. IP allowlists: accept postbacks only from the advertiser's known server IPs. Useful, but IPs can change and shared hosting complicates it, so treat it as one layer.
  3. Click ID validation: accept a conversion only if the click ID exists, belongs to that offer and partner, is recent enough for your attribution window and has not already converted.
  4. Rate limits: cap requests per IP, per offer and per minute. Spikes and bursts are suspicious. Return clear status codes when limiting.
  5. Replay protection: include a timestamp and a unique nonce or event ID. Reject old timestamps and event IDs you have already processed, so a captured valid request cannot be reused.

How the layers compare

LayerStopsWeaknessEffort
Signed tokenForged or altered requestsSecret must be kept safe and rotatedMedium
IP allowlistCalls from unknown serversIP changes, proxiesLow
Click ID validationMade-up click IDs and duplicatesNeeds a click storeMedium
Rate limitingBrute forcing and floodsSlow, low-volume abuseLow
Replay protectionReuse of captured requestsNeeds state storageMedium

Illustrative example: verifying a signed postback

The snippet below is a simplified illustration in Node.js. Adapt it to your stack, store secrets in environment variables and add proper logging and error handling.

js
import crypto from "crypto";

const MAX_AGE_SECONDS = 300;

export function verifyPostback(query, secret, seenEventIds) {
  const { click_id, payout, ts, event_id, sig } = query;

  if (!click_id || !payout || !ts || !event_id || !sig) {
    return { ok: false, reason: "missing_params" };
  }

  // Reject stale requests
  const age = Math.abs(Date.now() / 1000 - Number(ts));
  if (!Number.isFinite(age) || age > MAX_AGE_SECONDS) {
    return { ok: false, reason: "stale_timestamp" };
  }

  // Reject replays
  if (seenEventIds.has(event_id)) {
    return { ok: false, reason: "replay" };
  }

  // Recompute signature over the exact values received
  const payload = `${click_id}|${payout}|${ts}|${event_id}`;
  const expected = crypto.createHmac("sha256", secret).update(payload).digest("hex");

  const valid =
    expected.length === sig.length &&
    crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(sig));

  if (!valid) return { ok: false, reason: "bad_signature" };

  seenEventIds.add(event_id);
  return { ok: true };
}

After this check passes, still validate the click ID against your click store before crediting the conversion.

Operational practices

  • Log everything: store accepted and rejected requests with reason codes, IP and timestamp.
  • Rotate secrets: change shared secrets on a schedule and after any suspected leak.
  • Use HTTPS only, and never expose secrets in client-side code or public docs.
  • Avoid sensitive data in URLs, since query strings end up in logs. Consider POST bodies where partners support them.
  • Alert on anomalies: sudden spikes, many rejections or conversions with no click.
  • Reconcile regularly against advertiser records. See Tracking Discrepancy in Affiliate Marketing.

Postback security checklist

  • HTTPS enforced on the endpoint
  • Requests signed with a shared secret and verified
  • Timestamp window and unique event IDs enforced
  • Click IDs validated against stored clicks and attribution windows
  • Duplicate conversions rejected
  • IP allowlist applied where the advertiser has stable IPs
  • Rate limits and spike alerts configured
  • Secrets stored in environment variables and rotated
  • Accepted and rejected requests logged and reviewed

Conclusion

Postback security is about making each fake conversion cost more than it is worth. Sign requests, check the click, limit the rate and block replays, then watch your logs for what slips through. Layered controls also make audits and disputes far easier. For the wider tracking picture, see Server-Side Tracking for Affiliates.

Need a hardened S2S tracking setup?

Join thousands of publishers monetizing their audience with NextagMedia.

Talk to our tracking team

Frequently Asked Questions

It is the set of controls that make sure only genuine, authorised servers can record conversions through your postback URL, and that each conversion is valid and counted once.

No. URLs leak through logs, screenshots and shared documents. Use signatures and validation so that knowing the URL is not enough.

Not usually. They are a useful layer, but IPs can change and may be shared, so combine them with signed tokens and click validation.

Each request carries a timestamp and unique ID. The server rejects old timestamps and IDs it has already seen, so a captured request cannot be reused.

Usually yes, in stages. Start with click ID validation and duplicate rejection, then add signing, rate limits and replay checks, coordinating changes with advertisers.

Get Growth Insights in Your Inbox

Join thousands of marketers getting weekly affiliate & performance marketing insights.

No spam. Unsubscribe anytime.

Browse High-Converting Offers

Find your next top-performing offer from our curated marketplace.

Browse Offers
Anupam Kumar
Anupam Kumar

Performance Marketing Strategist

Anupam kumar a full-funnel performance marketing strategies that connect paid acquisition to affiliate and partnership channels. He has spent his career optimizing campaigns across search, social, and native platforms, with a particular focus on attribution modeling and budget allocation. Anupam writes frequently about the intersection of paid media economics and affiliate performance.

Comments