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.

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
- 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.
- 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.
- 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.
- Rate limits: cap requests per IP, per offer and per minute. Spikes and bursts are suspicious. Return clear status codes when limiting.
- 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
| Layer | Stops | Weakness | Effort |
|---|---|---|---|
| Signed token | Forged or altered requests | Secret must be kept safe and rotated | Medium |
| IP allowlist | Calls from unknown servers | IP changes, proxies | Low |
| Click ID validation | Made-up click IDs and duplicates | Needs a click store | Medium |
| Rate limiting | Brute forcing and floods | Slow, low-volume abuse | Low |
| Replay protection | Reuse of captured requests | Needs state storage | Medium |
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.
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.
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.

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
Related Articles
Affiliate Tracking Software Buyer's Guide 2027 (Checklist and Questions to Ask)
Choose affiliate tracking software on criteria, not demos. Use this checklist and question list to compare any platform fairly.
Affiliate Fraud Prevention
Fraud costs publishers and advertisers real money. Here is how to spot it early and keep your account in good standing.
What Is a Postback URL? S2S Tracking Explained
Postback URLs are the most reliable way to record affiliate conversions. Learn how server-to-server tracking works, with a clear example and fixes for common errors.
Click Fraud vs Install Fraud vs Lead Fraud: How to Spot Each
Click, install and lead fraud look different in the data. Learn how each one works, the signals that expose it and what to do first.



