# Reporting transactions

## Overview

Reporting your customer's transactions to the Loyalty Engine lets you set up reactors and program logic to reward members in transactional loyalty programs.

You should report **all transactions**—including non-member transactions—to enable comparison of loyalty vs. non-loyalty performance on key metrics such as average spend.

There are two ways to report transactions to WLL: submit an order via the Receipts API, or report a custom event using the Rewards API.&#x20;

{% hint style="info" %}
Your WLL onboarding manager will tell you which method to implement.
{% endhint %}

***

## Submit an order

This approach uses the Receipts API to process transactions in a standardized way, designed specifically for transactional loyalty programs.

* The **Receipts service** receives and stores orders, and automatically reports an intrinsic `ORDER_PLACED` event to the Loyalty Engine when you call [**`POST /orders`**](https://docs.whitelabel-loyalty.com/receipts#orders-orders-collection-post).
* The **Rewards service** then handles loyalty aspects such as awarding points or vouchers.
* Setup and configuration of the Receipts service for your tenant must be completed by WLL. Do not proceed unless advised by your onboarding or success manager.

#### Implementation steps

{% stepper %}
{% step %}

#### Identify member

Retrieve the member ID via POS (QR code or manual input) – you can retrieve either the WLL ID, the WLL account number, or the auth identifier.

See [User data, attributes & flags #User ID properties](https://app.gitbook.com/s/EFmrMvu6tg0ZiSX9SGEq/loyalty-engine/users/user-data-attributes-and-flags#user-id-properties "mention") for more information.
{% endstep %}

{% step %}

#### Lookup member

Unless you're identifying members using their auth identifier, you will need to call [**`GET /users/{id}`**](https://docs.whitelabel-loyalty.com/rewards#users-specific-user-get) using the WLL account ID or account number, and cache the `authIdentifier` returned in the response for all further calls.
{% endstep %}

{% step %}

#### Report the transaction

After payment is confirmed, send the order to the Receipts service using [**`POST /orders`**](https://docs.whitelabel-loyalty.com/receipts#orders-orders-collection-post) from your ERP.

* The `submitter` property **must** be an `authIdentifier` matching a WLL user.
* For transactions which are not related to a loyalty member, do not include a `submitter` in the request.
* Include data such as transaction ID, total amount, line items, location ID and cashier ID.
* <mark style="color:red;">**Never include PII in the request.**</mark>
  {% endstep %}

{% step %}
Once the order is submitted, the Receipts service automatically reports an `ORDER_PLACED` event in the Loyalty Engine, triggering any configured reactors to award points based on earning rules.
{% endstep %}
{% endstepper %}

***

## Report a custom event

This approach uses the Rewards API to report transactions as custom events. It requires you to first create a [custom event type](https://app.gitbook.com/s/EFmrMvu6tg0ZiSX9SGEq/loyalty-engine/events/event-types#custom-event-types) corresponding to transactions and a reactor which then awards points when an event of this type occurs.

#### Implementation steps

{% stepper %}
{% step %}

#### Identify member

Retrieve the member ID via POS (QR code or manual input).
{% endstep %}

{% step %}

#### Report the transaction

After payment is confirmed, call [**`POST /events`**](https://docs.whitelabel-loyalty.com/rewards.html#events-events-collection-post) from your ERP to report an event matching your custom event type for transactions.

* Include data such as transaction ID, total amount, branch ID, cashier ID, and basket details.
* Never include PII in the payload.
  {% endstep %}

{% step %}
The Loyalty Engine processes the event and triggers reactors to award points or rewards based on earning rules.
{% endstep %}
{% endstepper %}

***

## FAQs

#### How do I configure earn rate for points?

The earn rate (e.g., 1pt per £1 spent) and redemption value (e.g., 100pts = £1) are configured using reactors and can be fully customised in the Loyalty Engine.

#### Can I show points awarded for a transaction on a transaction's receipt?

Yes. The approach depends on how you report transactions to the Loyalty Engine:

* **Submit an order (Receipts API):**\
  After posting the order, wait 1-2 seconds, then:
  1. Fetch events ([`GET /events`](https://docs.whitelabel-loyalty.com/rewards.html#events-events-collection-get)) for the user using filter on `authIdentifier` and `ORDER_PLACED` (e.g. `subject.authIdentifier:(eq:abcd1234),type.name:(eq:'ORDER_PLACED')` )
  2. Check if the most recent event has the same transaction id in its payload.
  3. If so, call [`/events/{{id}}/reactions`](https://docs.whitelabel-loyalty.com/rewards.html#events-event-reactions-get) for `totalPoints`
* **Report a custom event (Rewards API):** \
  After reporting the event:
  1. Collect the event ID (`data.id`) from the response, and then call [`/events/{{id}}/reactions`](https://docs.whitelabel-loyalty.com/rewards.html#events-event-reactions-get) to get the `totalPoints` awarded.
