POST
Your webhook URLThe affiliate.payment event is triggered when a customer who was referred by an affiliate makes a payment. This event includes the payment amount and the commission generated for the affiliate.
Payload
json
{
"id": "evt_cm1xyz9876",
"event": "affiliate.payment",
"created_at": "2026-04-08T14:30:00.000Z",
"data": {
"customer_email": "[email protected]",
"affiliate": {
"email": "[email protected]",
"name": "Jane Smith",
"referral_code": "jane-smith"
},
"product": {
"id": "cuid_abc123",
"name": "My SaaS"
},
"amount_cents": 4900,
"commission_cents": 980
}
}
Payload fields
| Parameter | Type | Description |
|---|---|---|
idrequired | string | Unique event ID (prefixed with evt_). |
eventrequired | string | Always "affiliate.payment" for this event. |
created_atrequired | string | ISO 8601 timestamp of when the event occurred. |
data.customer_email | string | Email of the paying customer (may be null). |
data.affiliate.emailrequired | string | Email of the referring affiliate. |
data.affiliate.name | string | Name of the referring affiliate (may be null). |
data.affiliate.referral_coderequired | string | The referral code used for this customer. |
data.product.idrequired | string | Your Anderro product ID. |
data.product.namerequired | string | Your product name in Anderro. |
data.amount_centsrequired | integer | Payment amount in cents (e.g. 4900 = $49.00). |
data.commission_centsrequired | integer | Commission amount in cents earned by the affiliate. |
Example handler
javascript
app.post("/webhooks/anderro", (req, res) => {
const { event, data } = req.body;
if (event === "affiliate.payment") {
const amount = (data.amount_cents / 100).toFixed(2);
const commission = (data.commission_cents / 100).toFixed(2);
console.log(
`Payment: $${amount} from ${data.customer_email}, ` +
`commission: $${commission} to ${data.affiliate.email}`
);
// Update your revenue tracking
// Sync commission data to your accounting system
}
res.status(200).send("OK");
});
Amounts are in cents
All monetary values (amount_cents, commission_cents) are integers in cents. Divide by 100 to get the dollar amount.