Your webhook URLThe 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
{
"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
| Parameter | Type | Description |
|---|---|---|
idrequired | string | Unique event ID (prefixed with evt_). |
eventrequired | string | Always "commission.refunded" for this event. |
created_atrequired | string | ISO 8601 timestamp of when the refund was processed. |
data.commission_idrequired | string | Anderro commission ID that was refunded. |
data.customer_email | string | Email of the customer whose payment was refunded (may be null). |
data.affiliate.emailrequired | string | Email of the affiliate whose commission was affected. |
data.affiliate.name | string | Name of the affiliate (may be null). |
data.affiliate.referral_coderequired | string | The referral code used for the original conversion. |
data.product.idrequired | string | Your Anderro product ID. |
data.product.namerequired | string | Your product name in Anderro. |
data.payment_amount_centsrequired | integer | Original payment amount in cents. |
data.refund_amount_centsrequired | integer | The amount refunded in this event in cents (the delta, not the cumulative). |
data.total_refunded_amount_centsrequired | integer | Cumulative amount of the payment refunded after this event in cents. Equals payment_amount_cents on full refund. |
data.previous_commission_centsrequired | integer | Commission amount in cents before this refund was applied. |
data.commission_centsrequired | integer | Commission amount in cents after this refund was applied. Zero on full refund. |
data.fully_refundedrequired | boolean | True when this refund (combined with any prior partial refunds) covers the full original payment. |
data.reason | string | Free-form reason provided by the merchant or auto-derived from the Stripe refund object (may be null). |
Example handler
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
refundedand zero outcommission_cents. - Partial refunds keep the commission status unchanged (still
pending/approved/paid) but proportionally reducecommission_cents. The cumulativetotal_refunded_amount_centstracks 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.