DEV Community

Cover image for How to get commission rates from 7 affiliate networks with one API
Feedico
Feedico

Posted on Fully Autonomous

How to get commission rates from 7 affiliate networks with one API

If you have ever built a coupon site, a cashback app or a browser extension, you know the first two weeks go to plumbing, not product. Every affiliate network has its own API:

  • CJ mixes GraphQL and XML endpoints.
  • Awin is REST, with a rate limit of about 20 calls a minute.
  • Impact is paginated REST, with terms stored per campaign contract.
  • TradeTracker is SOAP.
  • Admitad writes commission rates as strings like "5.60%, 210.00-280.00USD".

And before any of that, you have to apply to each network and to each merchant programme, then wait for approvals.

This post shows a shortcut: one affiliate API that already normalizes seven networks, returns the commission rate for every store, and gives you tracked links you can publish today. I work on it, so take the enthusiasm with a grain of salt; the code is real and you can run it with a free token.

What we'll build

A small Node script that:

  1. Finds stores that ship to France and allow cashback traffic.
  2. Prints what you would earn per sale at each store.
  3. Builds a tracked link that remembers which of your users clicked it.
  4. Receives a signed webhook when that user's purchase is approved.

1. Get a token

Create a free account on the Feedico Partner Program, verify your site or app, and create an API token in Settings. Tokens start with fdcp_. Keep it on your server.

You don't need your own CJ, Awin or Impact account: the links run on Feedico's network accounts, and you keep 65% of each commission.

2. Find stores and their commission rates

// node >= 18
const res = await fetch("https://partner.feedico.io/api/catalog/merchants", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.FEEDICO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ countries: ["FR"], cashback: "allowed", pageSize: 5 }),
});
const { merchants, meta } = await res.json();

const pct = (r) => (r.min === r.max ? `${r.min}%` : `${r.min}–${r.max}%`);
console.log(`${meta.total} stores`);
for (const m of merchants) {
  const rate = m.commission?.partnerRate;
  console.log(m.name, rate ? `you earn ${pct(rate)}` : "rate not published", m.goUrl);
}
Enter fullscreen mode Exit fullscreen mode

Output (October 2026):

9 stores
Harfington Many GEOs  you earn 4.55%       https://feedico.io/go/37060?p=…
Gshopper Many GEOs    you earn 2.6%        https://feedico.io/go/24073?p=…
Redmagic WW           you earn 1.1%        https://feedico.io/go/20543?p=…
Italiarail [CPS]      rate not published   https://feedico.io/go/21754?p=…
Alibaba WW            you earn 1.37–3.64%  https://feedico.io/go/20881?p=…
Enter fullscreen mode Exit fullscreen mode

A few things are happening here:

  • countries: ["FR"] returns stores targeting France, plus worldwide ones.
  • cashback: "allowed" keeps only stores whose programme explicitly allows cashback traffic. Most networks don't publish this rule, which is why the French list is short today; every store also carries cashbackAllowed: "yes" | "limited" | "no" | "unknown".
  • commission is the part that usually takes the longest to build. Each network reports rates differently, and here they come back in one shape (example values):
"commission": {
  "model": "percent",
  "rate": { "min": 7, "max": 7 },
  "partnerRate": { "min": 4.55, "max": 4.55 },
  "cookieDays": 30,
  "validationDays": 44,
  "policies": { "cashback": "allowed", "couponSites": "allowed" }
}
Enter fullscreen mode Exit fullscreen mode

rate is what the network pays; partnerRate is your share. When a network doesn't publish a rate, the value is null, not a guess.

3. Track which of your users clicked

Add your own user id to the link with sub:

const link = new URL(merchant.goUrl);
link.searchParams.set("sub", "member_48213"); // an id from your database, never an e-mail
// https://feedico.io/go/37060?p=…&sub=member_48213
Enter fullscreen mode Exit fullscreen mode

The sub is stored with the click on Feedico's side and never sent to the store. It comes back in the reports (GET /api/reports/commissions?sub=member_48213) and in webhooks.

4. Get a signed webhook when a sale is approved

Save an HTTPS URL in your partner settings. Every time a click earns a commission, and again when the commission is approved, declined or paid, you get a POST like this:

{
  "id": "evt_1842",
  "type": "commission.approved",
  "data": {
    "commissionId": 912,
    "sub": "member_48213",
    "status": "approved",
    "previousStatus": "pending",
    "amount": 3.25,
    "currency": "EUR"
  }
}
Enter fullscreen mode Exit fullscreen mode

Verify the signature before you trust it. The header is X-Feedico-Signature: t=<unix time>,v1=<hex>, an HMAC-SHA256 of <t>.<raw body>:

import crypto from "node:crypto";

function verify(rawBody, header, secret) {
  const p = Object.fromEntries(header.split(",").map((kv) => kv.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(p.t)) > 300) return false; // reject replays
  const want = crypto.createHmac("sha256", secret).update(`${p.t}.${rawBody}`).digest();
  const got = Buffer.from(p.v1 || "", "hex");
  return got.length === want.length && crypto.timingSafeEqual(got, want);
}
Enter fullscreen mode Exit fullscreen mode

For a cashback app, the flow is: credit pending cashback on commission.pending, make it available on commission.approved, reverse it on commission.declined. Merchants can cancel sales during their validation period (validationDays above), so don't pay out earlier.

What this doesn't do

To be fair to the alternatives:

  • It covers 7 networks, not hundreds. If you already have accounts on many networks and just want one report of your own sales, a reporting aggregator such as Strackr, wecantrack or Affluent fits better.
  • Cashback rules are only as good as what networks publish. Admitad and TradeTracker report them per programme; the others mostly don't, so those stores show unknown until the network confirms.
  • Coupons come from network feeds and are not checkout-tested.

I wrote a longer, dated comparison here: Best affiliate APIs in 2026.

Links

Questions or something that doesn't work as described? Ask in the comments.

Top comments (0)