GuidesTrack Server-Confirmed Purchases

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. Avoid firing a second purchase from the browser for the same outcome unless you have deliberately designed and verified how duplicates are handled. A shared transaction ID is useful order context; it is not a promise that every collection or downstream system is idempotent.

Prepare the event

Use the active collection URL, Tenant ID, and Source ID from Setup. Send Content-Type: application/json and the tenant-id header. The request body follows this shape:

{
  "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.