Revenue & Refund Tracking
Track successful payments and refunds using Intempt's unified Charge event — the canonical revenue event for all financial transactions.
Revenue & Refund Tracking
Intempt uses a single, unified revenue event for all financial transactions. There is one revenue event name: Charge. Both successful payments and refunds use this event — differentiated only by their payload.
All revenue events must be sent from backend systems only. Never fire from the browser.
Successful Payments
Send a Charge event after payment gateway confirmation with these fields:
| Field | Required | Description |
|---|---|---|
eventId | Yes | Unique UUID — prevents duplicate processing |
userId | Yes | User email or profile identifier |
amount | Yes | Actual charged value |
status | Yes | Must be "succeeded" |
{
"track": [
{
"name": "Charge",
"payload": [
{
"eventId": "evt_charge_unique_uuid",
"userId": "customer@example.com",
"data": {
"amount": 99.99,
"currency": "USD",
"status": "succeeded",
"orderId": "order_456"
}
}
]
}
]
}Refunds
Use the same Charge event for refunds — replace amount with amount_refunded, keep status as "succeeded".
{
"track": [
{
"name": "Charge",
"payload": [
{
"eventId": "evt_refund_unique_uuid",
"userId": "customer@example.com",
"data": {
"amount_refunded": 99.99,
"currency": "USD",
"status": "succeeded",
"orderId": "order_456"
}
}
]
}
]
}A refund is a financial operation within the charge lifecycle, not a separate transaction type.
Rules
Always:
- Send events server-side only, never from the browser
- Generate a unique
eventIdper transaction to prevent duplication - Fire only after payment gateway confirmation
- Keep
userIdconsistent across all platforms
Never:
- Create separate
Purchase,Refund, orOrderCompletedevents - Fire on pending, failed, or unpaid transactions
- Reuse
eventIdacross multiple transactions - Trigger from frontend/client-side code
WooCommerce Example
Hook into woocommerce_payment_complete — fires only after the payment gateway confirms the charge:
add_action('woocommerce_payment_complete', function($order_id) {
$order = wc_get_order($order_id);
// Send to Intempt Track API
$payload = [
'track' => [[
'name' => 'Charge',
'payload' => [[
'eventId' => 'charge_' . $order_id . '_' . time(),
'userId' => $order->get_billing_email(),
'data' => [
'amount' => floatval($order->get_total()),
'currency' => get_woocommerce_currency(),
'status' => 'succeeded',
'orderId' => strval($order_id),
],
]],
]],
];
wp_remote_post($intempt_track_url, [
'body' => json_encode($payload),
'headers' => ['Content-Type' => 'application/json'],
]);
});For refunds, hook into woocommerce_order_refunded and use amount_refunded instead of amount.
Product Catalog Ingestion via API
Two methods for importing your product catalog into Intempt's Recommendations engine — catalog source feeds and direct API ingestion.
Recommendation Events Mapping
Map any tracked website event to standardized recommendation events — no changes to your existing tracking implementation required.
