Skip to main content
FHAVI

Free resource

Webhook profit enrichment template

A webhook tells you an order happened. It does not tell you whether the order made money. This template adds profit to the event before it reaches your ads and analytics: product cost, shipping cost, payment fees and discounts, matched to the order id. The result is a webhook your reporting can trust, because every event carries the margin, not just the sale price.Reviewed 2026-11-21 by Tarequl Islam Mukul, Managing Director

What it is

A webhook says what sold. Enrichment says what it earned

A plain webhook carries the order and the sale price. Enrichment adds the cost lines that turn that price into a profit figure. Without them, every report you build on the webhook overstates what you earned.

Example: an order for $60 with $28 product cost, $9 shipping paid and $2 in payment fees made $21, not $60. Enrich the event with the $21.

01

What enrichment adds to an event

  1. The order id, so the event can be matched back to the order in your store.
  2. Revenue for the order, in the currency the customer paid.
  3. Product cost for the items in the order, from your supplier or cost sheet.
  4. Shipping cost you paid, not the shipping fee the customer paid.
  5. Payment fees and any discount applied, so the margin is real.
  6. The resulting profit for the order, calculated from those lines.

The template

Ten fields on every event

Keep the field names the same in every event. A field that changes name between events is a field your reporting has to guess at, and it will guess wrong.

02

Fields to carry on every enriched event

  1. event_id — one unique id per event, so a retry is never counted twice.
  2. order_id — the store's own order number, exactly as it appears in the store.
  3. event_type — order created, order paid, or refunded, in your own words.
  4. revenue — the amount the customer paid, with the currency.
  5. product_cost — the cost of the items in that order.
  6. shipping_cost — what you paid the carrier or supplier to ship it.
  7. payment_fees — what the payment provider kept.
  8. discount — any discount applied to the order.
  9. profit — revenue minus product cost, shipping cost, payment fees and discount.
  10. event_time — when the order happened, in one timezone, written down.

Before you trust it

Check the events against the store

Run these checks on a handful of real orders before you switch any reporting to the enriched events. A webhook that is wrong in the same way every time looks reliable until you compare it to the store.

03

Checks that run before an event is sent

  1. The order id matches an order that exists in the store.
  2. The event id has not been sent before.
  3. Every cost line has a value — a missing cost is not a zero cost.
  4. The currency on the event matches the currency the customer paid.
  5. The profit line equals revenue minus the cost lines, checked by the sheet, not by eye.
04

Mistakes that double-count or misstate profit

  1. Sending the same event again when a webhook retries, with a new event id each time.
  2. Recording the shipping fee the customer paid as the shipping cost you paid.
  3. Leaving out payment fees because they arrive later in a payout.
  4. Counting a refunded order as profit because the refund event was never sent.
  5. Using the sale price as the profit figure in reports.

What to do with it

Trace five orders a week

The template is only useful if the events it produces are checked. A weekly trace of five orders takes minutes and catches the drift that makes a quarter of reporting wrong.

05

Weekly routine

  1. Pick five orders from the week and trace each one from the store to the enriched event.
  2. Confirm the profit on the event matches the profit in your P&L for the same order.
  3. List any event that failed a check, with the order id and the reason.
  4. Fix the source of the failure — the cost sheet, the mapping, the retry handling — not the event after the fact.

Keep going

The rest of the library

Every checklist here is free and ungated. The research pages carry the reasoning behind them.

All resources · Research library

Want this done for you? Store operations support

Send the details and we will tell you what to fix first, or quote the work if you would rather hand it over.

Prefer email? Write to md@fhavi.com