Unit transfers

The record of every change to a member's wallet, with its types, statuses and causes.

A unit transfer is a record of one change to a member's wallet. Every event that changes a balance creates a unit transfer, whether it adds, spends, blocks or expires units. Together they form the audit trail behind every balance.

Unit transfers

Types

TypeWhat it does
addAdds units, for example points for a purchase or a bonus.
spendTakes units out, for example when a member pays with points or buys a reward.
blockHolds units for an order that isn't finished yet.
unblockReleases held units back to the member, for example when an order is canceled.
expireRemoves units whose expiry date has passed.

Statuses

StatusMeaning
pendingCreated, but not applied yet. Added units with a delay stay pending until the delay ends, and they count as pending units in the wallet until then.
completedApplied to the balance.
canceledReversed before it was applied, for example pending points canceled by a return.
expiredThe units reached their expiry date and left the active balance.

Scops Loyalty checks pending and expiring transfers every 5 minutes. Pending units whose delay has ended become active, and units past their expiry date are removed.

Causes

Each transfer records what caused it:

  • campaign: a campaign action.
  • transaction: a purchase, a return, or points used at checkout.
  • reward: a reward the member bought with units.
  • admin: a manual change in the dashboard, or the opening balance of an imported member.

When you add units through the API, you choose the cause yourself.

The causeIdentifier links the transfer to its source, usually the transaction's documentIdentifier. That link is how a return finds the points of the original purchase.

Examples

Earning units from a campaign

  1. A member makes a 10,000 RSD purchase.
  2. A campaign that gives 1 point per 100 RSD matches it and calculates 100 units.
  3. A unit transfer is created with type: add, cause: campaign and status: completed, or status: pending if the campaign has a delay.
  4. The wallet gets +100 active or pending units.

Paying with points at checkout

  1. The member has 150 active units and wants to use 100 of them.
  2. The register sends the transaction with usedBenefits.units.amount: 100.
  3. A unit transfer is created with type: spend, cause: transaction and status: completed.
  4. The wallet loses 100 units, and the discount is on the transaction.

Tips

  • Reconcile balances against the transfer log regularly.
  • Use the metadata on each transfer to trace where it came from.