BlogEngineering

How to automate affiliate commission tracking that holds up to a dispute

Automate affiliate commission tracking with a clear record: attribution windows, reversals and proof for when a partner asks why they were paid.

Osman RamadanOsman Ramadan11 min read

Summarize with AI

How to automate affiliate commission tracking that holds up to a dispute
On this page

To automate affiliate commission tracking so it holds up to a dispute, build the record first and the calculation second. Affiliate commission is a payment based on an attribution decision: a partner receives money because your system concluded they caused a sale, and if they disagree they will ask you to show your working.

Disputes are about the record: what was attributed to whom, on what basis, and what changed afterwards. A system that cannot produce that record loses disputes by default.

What we'll cover

Key takeaways

  • The per-commission record (order, referral, timestamps, rule, rate and amount) matters more than the calculation, because disputes are settled from the record.
  • Attribution rules decide who gets paid when several partners touched a sale, so the terms must state the window and the click model.
  • Commission needs a holding period and a written reversal rule, because refunds and chargebacks arrive after the sale.
  • Automate the calculation and the statement, but have a person approve the payment.
  • Apply rule changes going forward and never recalculate history, so every past figure stays reproducible.

Commission is a payment, not a report

Commission is a payment, so errors move money in both directions.

Underpayment damages the relationship with the partner, who noticed before you did.

Overpayment is difficult to recover, especially once the money has been paid out.

Disputes are adversarial, because the other party has a direct financial interest in a different answer.

The terms are contractual. Write down what earns commission, over what period, at what rate, and when the commission is reversed. The automation should implement that document, not an interpretation of it.

Build for auditability first and convenience second. Most reporting automation is built the other way round.

How attribution windows work

An attribution window is how long after a click a sale still counts for the partner who sent it. Most disputes start at the edges of this window, so the terms must state it exactly.

The window length is agreed in the terms, in days or weeks.

Last click, first click, or shared credit decides who gets paid when several partners touched the journey. This is the most disputed rule.

Cross-device purchases break tracking. A customer who clicks on a phone and buys on a laptop may be attributed to nobody.

Cookie and tracking limits mean some genuine referrals are never recorded. This affects partners unevenly and is not their fault.

Direct traffic that was actually referred is the mirror image, and it is invisible.

State every rule in the terms. A partner who believes they operate under first-click rules and is paid under last-click will eventually notice.

How to handle reversals

Commission must reverse when the sale reverses, so build reversals into the first version, not as an afterthought.

A refunded sale reverses the commission. A cancelled subscription usually does too.

Chargebacks reverse the commission. They arrive weeks after the sale, often after the commission has been paid.

Fraudulent or test orders never earned commission and need removing.

Set a holding period before payment, long enough to cover your refund window, and write it in the terms instead of applying it unilaterally.

Handle reversals after payment explicitly. Deduct them from the next payout, or invoice the partner, using a rule agreed in advance.

Report each reversal to the partner with its reason. An unexplained deduction is the fastest route to a dispute, and an explained one is usually accepted.

Building it with CodeWords

CodeWords connects to 3,000+ integrations (CodeWords integrations page, 2026), so orders, refunds, and partner records can be joined into one calculation without anybody reconciling spreadsheets.

  1. Open CodeWords and start a new automation.
  2. Describe what should happen in plain language to Cody, the automation builder: what earns commission, at what rate, over what window, and when commission is held or reversed.
  3. Authorize the connections: the commerce platform, the payment provider, and wherever partner records live.
  4. Describe the exceptions: an order that cannot be attributed, a refund after payment, a rate that changed mid-period.
  5. Run it against a past period and compare the result with what was actually paid.

You describe the outcome; Cody builds it, connects it, and deploys it. The Free plan costs $0, Pro costs $39 per month and Business costs $100 per month (CodeWords pricing page, 2026). Details are on the pricing page.

The record that answers a dispute

The per-commission record is the artefact the whole system exists to produce.

Per commission, record the order, the click or referral that earned it, the timestamps of both, the rule applied, the rate, and the resulting amount.

Record the rate version. Rates change, and a commission calculated under an old rate must be explicable later.

Keep the unattributed orders too. Orders that earned nobody commission are what a partner means by "what about this sale", and the record turns a suspicion into an answer.

Timestamp everything in a stated timezone, because window-edge disputes turn on hours.

Make the record available to the partner, not only to your team. A partner who can see their own detail raises fewer disputes, and better ones.

Do not recalculate history. When a rule changes, apply it going forward and keep what was calculated before. Otherwise every historical figure becomes unreproducible.

How to detect affiliate fraud

Fraud appears at any scale, so build detection into the calculation and report anomalies instead of acting on them.

Self-referral, where a partner buys through their own link, is the most common type and the easiest to detect.

Coupon and brand-term bidding, where the terms prohibit it, captures traffic that was arriving anyway.

Cookie stuffing sets a referral without a genuine click and shows up as an implausible click-to-sale ratio.

Sudden volume changes from one partner, up or down, deserve a look before anyone celebrates.

Refund rate by partner is the clearest signal, because traffic that converts and then refunds heavily is rarely the traffic you wanted.

Report anomalies for review. Withholding a payment is a serious step, and an automated accusation against a legitimate partner is worse than a delayed investigation.

How to pay commissions

Automate the calculation and the statement, and have a person approve the payment. Payment is the finance step, and an error here moves real money.

Reconcile the total against your own records before anything is paid.

Handle tax and invoicing per partner and per jurisdiction. Rules vary, and this is a finance question, not an engineering one.

Set a minimum payout threshold to avoid many tiny transfers, and state it in the terms.

Send the statement before the payment, with detail, so a partner can query it before the money moves.

Keep payment records alongside commission records. An audit will ask you to reconcile the two.

What partners want to see

Partner reporting is cheap to build and does more for the relationship than the payment schedule.

Near-real-time attribution, not a monthly statement. A partner who sees a sale land the same day trusts the system more than one who waits.

Pending and confirmed amounts, shown separately, so the holding period is visible instead of looking like a missing payment.

Reversals with reasons, itemised, because an unexplained deduction is the most common trigger for a dispute.

Their own conversion rate, which helps them improve and costs you nothing to show.

What is coming: the next payment date and the amount as it stands.

Consistency above all. A statement whose format or method changes month to month looks like something is being adjusted, whatever the intent.

How to make the automation reliable

A reliable commission run gives the same answer every time and never changes a past figure without a trace.

Make the calculation idempotent and reproducible, so running it twice for a period produces the same answer.

Version the rules and record which version each commission used.

Handle the partner with no valid payment details without failing the whole run.

Never silently adjust a historical figure. Issue an adjustment with a reason instead.

Report the outcome: commissions calculated, held and reversed, unattributed orders, and anything that needs a person.

Limits of commission tracking

Commission tracking has limits that no automation removes.

Some genuine referrals cannot be tracked. The share varies by browser and device and affects partners unequally.

Attribution across channels is decided by a rule, not resolved. Every rule disadvantages somebody.

Refund and chargeback timing varies, so the holding period is a commercial decision, not a technical one.

Partner data includes payment details, among the most sensitive data you hold. Scope access and log it accordingly.

This is not tax or contract advice. Withholding, invoicing, and what your terms permit are questions for whoever advises you.

What to build first

Build the per-commission record first: order, referral, both timestamps, the rule and rate applied, and the resulting amount, produced as part of the calculation and not reconstructed afterwards. Every dispute is answered from this record, and a system that calculates correctly without producing it still loses arguments it should win.

Two habits make the difference. Record the rule and rate version used, because a commission from eight months ago must remain explicable. And keep the unattributed orders, because "what about this sale" is the most common partner question and only that record answers it.

Frequently asked questions

What is the most important part of commission automation?

The record matters more than the calculation. Every dispute is answered from the record, so a system that calculates correctly but cannot show its working loses arguments it should win. Build the per-commission record first, then add the calculation on top of it.

What should the commission record contain?

The record contains the order, the referral that earned it, both timestamps in a stated timezone, the rule applied, the rate and its version, and the amount. It also includes the unattributed orders, because partners ask about those sales most often.

Why do partners dispute attribution?

The attribution rule decides who gets paid when several partners touched the journey, and every rule disadvantages somebody. Last click, first click, and shared credit produce different winners, so the terms must say which rule applies and how long the window lasts.

How should refunds be handled?

Set a holding period before payment that covers your refund window, and agree it in the terms. Add a stated rule for reversals that arrive after payment, deducted from the next payout or invoiced. Always report the reason to the partner.

What fraud signals are worth watching?

Watch for self-referral, prohibited brand-term bidding, implausible click-to-sale ratios, sudden volume changes, and refund rates by partner. Report these signals for human investigation instead of acting on them automatically, because a false accusation damages a legitimate partnership. Hold flagged commissions for manual review before any payout is made.

Should the payment itself be automated?

No, a person should approve the payment. Automate the calculation and the statement, reconcile the total against your records, and then approve the transfer. An error at this point moves real money in a direction that is hard to reverse.

Why not recalculate history when a rule changes?

Recalculation makes every historical figure unreproducible, and a partner who compares an old statement with a new calculation will find a discrepancy you cannot explain. Apply changes going forward and issue adjustments explicitly, with a reason attached to each one.

What should partners be able to see?

Partners should see near-real-time attribution instead of a monthly statement, pending and confirmed amounts separately, itemised reversals with reasons, and the next payment date and amount. Visibility prevents more disputes than accuracy alone does. Showing partners their own data also reduces support questions about missing or pending commissions.

Why separate pending from confirmed amounts?

Without the split, the holding period looks like a missing payment. A partner who can see an amount sitting in a stated holding window asks nothing, while a partner who sees an unexplained gap asks immediately and may open a dispute.

Get started today

Your first workflow is free to build.

Describe what you need. Cody handles the build, the connections, and the deployment.