Skip to content

Sending server events

Your backend already knows when money moves, and when it stops. This page turns three of those moments into Fidero events, with the same small request each time: a Stripe renewal, a CRM cancellation and a nightly batch of trial conversions. The HTTP API documents every field used here, and Server-side events explains why these events matter.

Stripe reports a successful renewal with an invoice.paid webhook. The handler looks up your user from the Stripe customer, then reports the renewal:

stripe-webhooks.js
// webhook handler for invoice.paid
const invoice = stripeEvent.data.object;
const user = await findUserByStripeCustomer(invoice.customer);
await fetch("https://api.datahappy.co/v1/t", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
authToken: process.env.FIDERO_API_TOKEN,
projectId: "YOUR_PROJECT_ID",
type: "track",
event: "subscription_renewed",
userId: user.id,
properties: {
transaction_id: invoice.id,
value: invoice.amount_paid / 100,
currency: invoice.currency.toUpperCase(),
},
messageId: invoice.id,
}),
});

Fidero matches userId to the customer’s profile and delivers the renewal with their attribution and identity already attached – there’s nothing to look up on your side. Setting transaction_id and messageId to the invoice ID keeps the renewal counted once, everywhere it’s delivered.

A cancellation recorded in your CRM (entered by a support agent or synced from billing) is worth reporting the moment it’s known. Only the body changes. Transport and auth stay as above:

{
"authToken": "YOUR_API_TOKEN",
"projectId": "YOUR_PROJECT_ID",
"type": "track",
"event": "subscription_cancelled",
"userId": "user_7Kd93A"
}

No properties are needed – the event itself is the signal, and the profile carries the rest. Data schema covers the properties available when there’s more to say.

A job that settles trial conversions overnight reports events hours after they happened. Set timestamp to when the conversion actually occurred, and Fidero records it then rather than at arrival:

{
"authToken": "YOUR_API_TOKEN",
"projectId": "YOUR_PROJECT_ID",
"type": "track",
"event": "trial_converted",
"userId": "user_3Xf51B",
"properties": {
"transaction_id": "inv_8Sw2H6",
"value": 15.99,
"currency": "GBP"
},
"messageId": "inv_8Sw2H6",
"timestamp": "2026-07-03T02:14:00Z"
}

The HTTP API has the timestamp rules.