Track Server-Confirmed Purchases
Send confirmed backend orders to Hardal while preserving purchase and session context.
A server-confirmed purchase records the business outcome when your backend accepts the payment or order, rather than depending on a confirmation page being opened. Use the collection API for this flow.
Choose the authoritative trigger
Pick one confirmed order state and one sender. Reuse the order's transaction_id and prevent duplicate sends in that system. A shared transaction ID alone does not deduplicate submissions to Hardal.
Prepare the event
Use the active collection URL, Tenant ID, and Source ID from Setup. Send Content-Type: application/json and a valid User-Agent. Put tenantId at the top level of the JSON body:
{
"tenantId": "your-tenant-id",
"type": "event",
"eventName": "purchase",
"payload": {
"sourceId": "your-source-id",
"url": "https://www.example.com/order/confirmation",
"timestamp": 1794402000000,
"data": {
"transaction_id": "ORDER-12345",
"value": 99.9,
"currency": "USD",
"items": [
{ "item_id": "SKU-1", "item_name": "Example product", "price": 49.95, "quantity": 2 }
]
}
}
}
Replace the example timestamp with the order's actual occurrence time in Unix milliseconds. Keep that original time if delivery is delayed. Use real source and order values; this is an illustrative payload, not a production order.
Preserve the available visit context
When the backend legitimately has the originating session UUID, send it as x-hrd-session-id to retain that grouping. Do not create one fixed UUID for all orders. Without visit context, the server purchase is not automatically attached to a browser journey.
Handle consent and supplied identity according to API & Server-side Setup. Do not add personal details to the confirmation URL.
Verify the outcome
Place a test order and inspect the stored purchase in Events. Confirm transaction ID, total, currency, item price and quantity, time, source, and session. Then check Commerce and the relevant checkout funnel. A collection acknowledgement is not the final reporting check.
Check the result
Compare the stored purchase with the test order in your application. Confirm that your intended sender did not also emit a second purchase for that outcome. If it appears in Events but not Commerce or the checkout funnel, check the Commerce tenant type, required purchase fields, report dates, and session context separately.