> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omneo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Transaction mapping

> How a Remira sale becomes an Omneo Transaction, including which sales are recorded, how identifiers are composed, and how each sale, line, and payment field maps.

Every finished Remira sale becomes an Omneo Transaction. This page lists what each Transaction, line item, and payment field is built from, so you can reconcile a receipt in Remira against the Transaction Omneo recorded.

## Which sales are recorded

Omneo reads the state of the sale before anything else.

| Sale state                                                | Result                                                                                                        |
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| Finished                                                  | Recorded as a Transaction.                                                                                    |
| Any other state, such as a layby or an unfinished receipt | Recorded as an Order, but only when order creation is enabled for your tenant. Otherwise the sale is ignored. |

Two further rules apply:

* A sale with no lines is ignored.
* Transactions are immutable. Reposting a sale that Omneo has already recorded does not create a second Transaction, and does not change the first. Orders are mutable, so a reposted Order is updated in place.

## Identifiers

Omneo composes two identifiers rather than copying one from Remira.

| Field         | Built from                                                                                                                       |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `external_id` | The region prefix, the branch, the till, the receipt number, and the customer. A sale with no customer uses a dated guest value. |
| `receipt_ref` | The branch, the till, and the receipt number. No prefix and no customer.                                                         |

`external_id` is the unique key. `receipt_ref` is the human-readable value to quote when reconciling against a printed receipt. The leading digits of `external_id` identify the region that recorded the sale.

## Transaction fields

| Omneo field      | Source in the Remira sale                                                                                         |
| ---------------- | ----------------------------------------------------------------------------------------------------------------- |
| `external_id`    | Composed, see [Identifiers](#identifiers).                                                                        |
| `receipt_ref`    | Composed, see [Identifiers](#identifiers).                                                                        |
| `profile_id`     | The matched Profile. Omitted when no Profile is matched.                                                          |
| `currency`       | The currency of the first sale line.                                                                              |
| `total`          | The sum of the gross line values.                                                                                 |
| `total_original` | The same value as `total`.                                                                                        |
| `transacted_at`  | The sale timestamp, converted to UTC.                                                                             |
| `location_id`    | The region location prefix and the branch identifier.                                                             |
| `staff_id`       | The region staff prefix and the salesperson on the first line. Empty when the sale records no salesperson.        |
| `status`         | Always `completed`.                                                                                               |
| `redemption_id`  | The discount transaction reference Remira returns on a redeemed Benefit, read from the sale text attributes.      |
| `need_action`    | Set when transaction enrichment is enabled for your tenant, which flags the Transaction for follow-up processing. |
| `meta.import_id` | The Remira receipt number.                                                                                        |
| `meta.original`  | The sale as Remira sent it, retained in full.                                                                     |

`order_number` is not populated from Remira.

## Line items

Each Remira SKU line becomes one Transaction item.

| Omneo field                  | Source in the Remira sale line                                      |
| ---------------------------- | ------------------------------------------------------------------- |
| `external_id`                | The Transaction `external_id` and the line position, starting at 1. |
| `name`                       | The item short description.                                         |
| `quantity`                   | The line quantity.                                                  |
| `price_current`              | The original unit price.                                            |
| `price_sell`                 | The price the line actually sold at.                                |
| `price_tax`                  | The line VAT amount divided by the quantity, to two decimal places. |
| `product_variant.product_id` | The item entity identifier.                                         |
| `product_variant.sku`        | The SKU entity identifier.                                          |
| `product_variant.title`      | The item short description and the SKU size.                        |
| `product_variant.category`   | Always `Product`.                                                   |
| `product_variant.brand`      | The item brand identifier, or `Unknown` when the item carries none. |
| `product_variant.price`      | The original unit price.                                            |

Line-level discounts map to the item's `discounts` array, one entry per Remira discount line, carrying the discount reason description and the discount amount.

## Payments

Each Remira payment line becomes one Transaction payment.

| Omneo field    | Source in the Remira payment line |
| -------------- | --------------------------------- |
| `payment_code` | The payment type description.     |
| `tender_value` | The payment amount.               |

`payment_code` carries the description Remira sends, such as `Visa` or `Cash`, not a numeric code.

## How a Profile is matched

Omneo tries each step in order and stops at the first match.

<Steps>
  <Step title="By Identity">
    The Remira `customerEntityId` is looked up as an Omneo Identity, using the handle configured for your tenant, `remira` by default.
  </Step>

  <Step title="By Omneo Profile ID">
    If Remira holds the Omneo Profile ID against the customer, Omneo reads the Profile directly.
  </Step>

  <Step title="By email">
    Omneo matches on the customer's email address. When the POS was offline at the time of sale, the address on the printed receipt is used instead.
  </Step>

  <Step title="By creating a Profile">
    Only when Profile creation is enabled for your tenant. A sale that reaches this step with creation disabled is recorded as a Transaction with no Profile attached.
  </Step>
</Steps>

When a Profile is created, Omneo takes the name, email, mobile number, and default billing address from the sale, sets the joined and preferred locations from the customer's creating and home branches, and applies the region configured for your tenant. A customer with no email address is given a placeholder so the Profile can still be created.

## Custom field mapping

The mapping above is the default. Your tenant can map additional values out of the Remira sale onto the Transaction without an Omneo release, by adding entries that name a path in the sale and the Omneo field to write. Each entry can read a value directly, select an item from a list by matching one of its properties, apply a default when the sale has no value, and convert the result to a string, a number, or a list.

Custom entries are applied last, so a custom entry that targets one of the fields above overrides the default behaviour. Contact your Omneo account manager to configure them.

## Related

* [Remira](/extensions/remira/overview)
* [Transactions](/concepts/commerce/transactions)
* [ERP and POS extensions](/concepts/extensions/erp-pos)
* [Transaction API](/api-reference/transaction)
