Skip to main content

Receiving the journals

Journals are published as events. An external system subscribes through External Events. Hii Retail services can subscribe to the Pub/Sub topic directly.

TechSubscribe toVersion
External EventsGLE: General ledger aggregations (gl-aggregations)v1
Pub/Subgle.public.event.general-ledger.v1v1

Each event is one journal: one business unit, one business date, and a debit and credit amount per account. The format is described in General ledger format. What a journal means, and when one is sent, is in Journals and deltas.

Rules for an accounting integration​

1. Post every journal, and add them up​

🛑 Never treat the latest journal for a day as the whole day. The first journal for a store-day is followed by delta journals whenever the day changes afterwards: late transactions, or a recompute after a rule was fixed. Each delta holds only the difference.

the day = the sum of every journal received for that businessUnitId and businessDate

Each journal balances on its own, so each can be posted as a separate voucher in your accounting system.

2. Skip journals you already have​

Delivery is at least once, so the same journal can arrive twice. A re-export also sends journals that were sent before, deliberately. Posting one twice doubles the day.

The deduplication key is the tenant, businessUnitId and journalId together. journalId identifies a journal within a business unit, and two business units can each have a journal 5. A journal received again always has the same content.

3. Do not depend on the order​

Journals can arrive in any order. Since each is a difference added to the day, the order does not change the result. If you want a sequence, journalId increases with every journal for a business unit.

4. Post debits and credits as they come​

  • Amounts are never negative. A correction that reduces an account arrives on that account's opposite side, so a sales account can receive a debit and a tender account a credit.
  • An account can have both a debit and a credit in the same journal. For example, a day's sales and returns on one sales account appear as a credit and a debit, not netted.
  • An account that does not appear in a journal did not change.

5. A journal can arrive long after its business date​

businessDate is the day the journal belongs to, not the day it was sent. A delta for a late transaction or a correction can arrive days or weeks later. If that period is already closed in your accounting system, handle it the way your accounting practice handles a late adjustment. The journal tells you exactly which day it adjusts.

The message​

{
"businessUnitId": "EU002",
"businessDate": "2026-09-23",
"journalId": 44,
"accounts": [
{ "accountId": "3000", "debitAmount": 300, "creditAmount": 0 },
{ "accountId": "3010", "debitAmount": 0, "creditAmount": 300 }
]
}
FieldRequiredMeaning
businessUnitIdyesthe store
businessDateyesthe business day, YYYY-MM-DD
journalIdyesthe journal's number within the business unit
accountsalways presentat least one account. accountId, debitAmount and creditAmount are always set, and amounts have two decimals.

The journal carries no currency code and no tenant ID. The tenant is known from your subscription and from the Tenant-Id attribute. Ignore fields you do not recognise, so that a field added later does not break your integration.

Message attributes​

On Pub/Sub, each message carries these attributes, which you can use for filtering:

AttributeValue
Tenant-Idthe tenant
Business-Unit-Idthe store, the same as businessUnitId
Business-Datethe business day, the same as businessDate
Correlation-Ida trace ID for the export or request that produced the message
Event-TypeEXPORT_GENERAL_LEDGER or RE_EXPORT_GENERAL_LEDGER, see below

Telling a re-export apart​

A journal sent again by a re-export has Event-Type RE_EXPORT_GENERAL_LEDGER. Everything else, including the correction journals a recompute produces, is EXPORT_GENERAL_LEDGER, because a correction is an ordinary new journal that must be posted. Deduplicating on journalId handles re-exports correctly whether or not you read this attribute.