For the complete documentation index, see llms.txt. This page is also available as Markdown.

Transactions

Sending purchases and returns from e-commerce and stores to Open Loyalty so members earn — with the API calls, webhooks and checks for each step.

Transactions are purchases and returns. When one reaches Open Loyalty and matches a member, purchase or return campaigns decide what the member earns or loses. This page covers sending them reliably from e-commerce and stores.

For non-purchase activity — reading an article, scanning a code, registering a device — use custom events instead. For the Admin Panel side, see Transactions and the purchase transaction campaign trigger.

Who does what

Area
Responsibility

Admin Panel

Channels, purchase and return campaigns, transaction item filters for SKU or category rules

Integration layer

Turns orders and receipts into transactions, sends them once, retries safely, sends returns linked to the original sale, matches guest orders later

E-commerce platform / POS

Reports completed orders, receipts and returns with the customer's identifier

CRM / marketing automation

Receives balance changes through webhooks and tells the member what they earned

Design decisions

Decision
Options
Recommendation

When to send a purchase

At order placement, payment, shipment or after the return window

Send it when the order can no longer be cancelled without a return — usually at payment or shipment. If returns are frequent, consider the wallet's unit pending method so points become spendable only after the return window.

Document number

Order ID, invoice number, receipt number

A number that is unique per tenant across all channels. If two channels can produce the same number, prefix it (WEB-1001, STORE12-1001).

How much item detail

Totals only, or every line with SKU, category, maker

Send lines with SKU and category if any campaign rewards specific products, now or later.

Guest purchases

Ignore, or send unmatched and match later

Send them unmatched; the member can claim them after registering.

Earning on returns

Leave points, or deduct them

Configure return campaigns that mirror your purchase campaigns.

1

Configure (Admin Panel)

Create a channel per sales channel (web shop, app, each store group) and note their IDs. Set up purchase campaigns and, if points should be taken back, matching return campaigns.

2

Send purchases

POST /api/{storeCode}/transaction with header.documentType = sell, a unique header.documentNumber, header.purchasedAt, channelId, the member identifier in customerData (e.g. loyaltyCardNumber) and the items. Open Loyalty matches the member and runs purchase campaigns.

3

Retry safely

Document numbers are unique per tenant. If a request times out, resend it with the same document number: a 400 with an error on header.documentNumber ("document number should be unique") means the first attempt was recorded — treat it as success.

4

Send returns

POST /api/{storeCode}/transaction with documentType = return, its own documentNumber, the returned items, and linkedDocumentNumber set to the original sale. A return whose linked sale doesn't exist is rejected — make sure the sale was sent first.

5

Match guest purchases

Send guest orders without member identifiers; they're stored as Not matched. When the customer registers or logs in and claims the order, call POST /api/{storeCode}/transaction/assign with the transactionDocumentNumber and the member's identifier. Campaigns run at that point. See Matching transactions with members.

6

Tell the member

Subscribe to WalletBalanceUpdated (or TransactionRegistered if you message on the purchase itself) and pass it to CRM or marketing automation.

Sequence diagrams

The e-commerce platform or POS reports a completed order. The integration layer sends it to Open Loyalty as a sell transaction with the order number as document number, the member's loyalty card number, the items and the channel. Open Loyalty matches the member, runs purchase campaigns and adds units, returns the transactionId and sends a WalletBalanceUpdated webhook, which is passed to CRM. A retry with the same document number returns 400 because it is already recorded.
Purchase
The channel reports returned items. The integration layer sends a return transaction with its own document number and the original order number as linked document number. Open Loyalty checks the original sale exists and runs return campaigns, for example deducting the units earned. Tiers, campaign limits and counters from the original purchase are not reverted.
Return
A guest order is sent without member identifiers and stored as not matched, with no units. Later the customer claims the order; the integration layer calls transaction assign with the document number and the member's loyalty card number, and Open Loyalty matches the transaction and runs purchase campaigns.
Guest purchase matched later

Returns are a separate flow. A return campaign can deduct units, but it doesn't revert a tier, campaign limits or counters that the original purchase affected. See Returns and cancellations.

Go-live checklist

Admin Panel

Integration layer

Channels and CRM

Validation

Key endpoints

Webhooks: TransactionRegistered, TransactionAssignedToCustomer, WalletBalanceUpdated

Last updated

Was this helpful?