Consumptions
Recording your members' purchases so they earn points, by client code or by email.
A consumption is the record of a purchase. It is what triggers the point calculation: every time a member buys, your system tells Loybox and Loybox adds the points that apply.
It is the minimum integration of a loyalty program. If you are only going to call one endpoint in this whole API, it is one of these two.
The two endpoints
They do the same thing and differ only in how they identify the member:
| By code | By email | |
|---|---|---|
| Identifies the member with | Their client_code | Their email |
| If the member does not exist | Returns 404 | Records the consumption anyway and invites them by email |
| When to use it | A point of sale or app where the member gives their code | An online checkout, where you already have the email |
Create consumption by code
When the member identifies with their Loybox code.
Create consumption by email
When you already have the email, even if the member is not registered.
How many points it earns
The call does not decide that: the commerce's configuration does. You send the purchase amount and Loybox applies the money-per-point rule, double points if they are running, and the member's tier bonus, in that order.
The formula and the order of the multipliers are in Technical reference.
The amount is an integer
The amount field is an integer: whole units of the commerce's currency, no
decimals. A purchase of 1,750.50 is sent as 1750.
Credential
Both endpoints go from your server, with the commerce API key:
Authorization: Bearer {api-key}