commission.refunded

Fired when a commission is voided or reduced because the underlying payment was refunded.

POSTYour webhook URL

The commission.refunded event is triggered whenever a commission is adjusted because the underlying customer payment was refunded - either fully (commission voided) or partially (commission proportionally reduced). The event fires regardless of whether the refund was initiated via the POST /api/v1/refunds endpoint, an automatic charge.refunded Stripe webhook, or manually from the Anderro dashboard.

Payload

json
{
  "id": "evt_cm1xyz9876",
  "event": "commission.refunded",
  "created_at": "2026-04-15T10:00:00.000Z",
  "data": {
    "commission_id": "comm_abc123",
    "customer_email": "[email protected]",
    "affiliate": {
      "email": "[email protected]",
      "name": "Jane Smith",
      "referral_code": "jane-smith"
    },
    "product": {
      "id": "cuid_abc123",
      "name": "My SaaS"
    },
    "payment_amount_cents": 4900,
    "refund_amount_cents": 4900,
    "total_refunded_amount_cents": 4900,
    "previous_commission_cents": 980,
    "commission_cents": 0,
    "fully_refunded": true,
    "reason": "Customer requested refund within trial period"
  }
}

Payload fields

ParameterTypeDescription
idrequired
stringUnique event ID (prefixed with evt_).
eventrequired
stringAlways "commission.refunded" for this event.
created_atrequired
stringISO 8601 timestamp of when the refund was processed.
data.commission_idrequired
stringAnderro commission ID that was refunded.
data.customer_email
stringEmail of the customer whose payment was refunded (may be null).
data.affiliate.emailrequired
stringEmail of the affiliate whose commission was affected.
data.affiliate.name
stringName of the affiliate (may be null).
data.affiliate.referral_coderequired
stringThe referral code used for the original conversion.
data.product.idrequired
stringYour Anderro product ID.
data.product.namerequired
stringYour product name in Anderro.
data.payment_amount_centsrequired
integerOriginal payment amount in cents.
data.refund_amount_centsrequired
integerThe amount refunded in this event in cents (the delta, not the cumulative).
data.total_refunded_amount_centsrequired
integerCumulative amount of the payment refunded after this event in cents. Equals payment_amount_cents on full refund.
data.previous_commission_centsrequired
integerCommission amount in cents before this refund was applied.
data.commission_centsrequired
integerCommission amount in cents after this refund was applied. Zero on full refund.
data.fully_refundedrequired
booleanTrue when this refund (combined with any prior partial refunds) covers the full original payment.
data.reason
stringFree-form reason provided by the merchant or auto-derived from the Stripe refund object (may be null).

Example handler

javascript
app.post("/webhooks/anderro", (req, res) => {
  const { event, data } = req.body;

  if (event === "commission.refunded") {
    const clawback =
      (data.previous_commission_cents - data.commission_cents) / 100;

    console.log(
      `Refund: $${clawback.toFixed(2)} clawed back from ` +
      `${data.affiliate.email} on commission ${data.commission_id}`
    );

    if (data.fully_refunded) {
      // Mark the commission as voided in your accounting system
    } else {
      // Update the commission amount to data.commission_cents
    }
  }

  res.status(200).send("OK");
});

When does this fire?

This event fires every time a refund is recorded against a previously-tracked payment:

  • Full refunds flip the commission to refunded and zero out commission_cents.
  • Partial refunds keep the commission status unchanged (still pending / approved / paid) but proportionally reduce commission_cents. The cumulative total_refunded_amount_cents tracks how much of the payment has been refunded across multiple partial refunds.

Idempotent

A commission that has already been fully refunded does not fire this event again. Subsequent calls to the refund endpoint return 409 Conflict instead.

Paid commissions

When the underlying commission had already been paid out to the affiliate before the refund, Anderro records the clawback and emails the affiliate. The actual recovery of funds (deducting from next payout, invoicing the affiliate, writing off, etc.) is handled by the business outside Anderro.