Summary
When a customer redeems a loyalty reward at the POS, we needed to detect how much points the customer has used.
We have been able to do so via the following steps.
- Receive an
order.createdwebhook. - Resolve the Square customer from the order.
- Look up the customer’s loyalty account.
- Call
SearchLoyaltyRewardswithstatus = REDEEMEDfor that loyalty account. - Derive the redeemed points from the returned reward(s).
However, for a single merchant, response data for SearchLoyaltyRewards does not look right(differs from other merchants), and we cannot derive how much points were redeemed.
Usual response for SearchLoyaltyRewards
A normal redemption produces two loyalty events, both carrying a reward_id, and SearchLoyaltyRewards returns the reward:
{
"events": [
{
"type": "REDEEM_REWARD",
"redeem_reward": {
"loyalty_program_id": "PROGRAM_ID",
"reward_id": "REWARD_ID",
"order_id": "ORDER_ID"
}
},
{
"type": "CREATE_REWARD",
"create_reward": {
"loyalty_program_id": "PROGRAM_ID",
"reward_id": "REWARD_ID",
"points": -100,
"order_id": "ORDER_ID"
}
}
]
}
Abnormal response for SearchLoyaltyRewards
For one merchant, a redemption clearly happened — the loyalty account balance dropped by 100 points (139 → 39) within ~3 seconds of the POS checkout, and the order shows a matching discount. The store staff redeemed the reward using the standard Square POS “redeem a reward” flow (selecting a reward from the loyalty program); we have confirmed this via a recording of the POS operation. However:
SearchLoyaltyRewards(loyalty_account_id, status = REDEEMED)returns an empty result ({}), both immediately after checkout and ~6 hours later.- The loyalty events for that order contain a
REDEEM_REWARDevent without areward_id, and there is no correspondingCREATE_REWARDevent at all:
{
"events": [
{
"type": "REDEEM_REWARD",
"redeem_reward": {
"loyalty_program_id": "PROGRAM_ID",
"order_id": "ORDER_ID"
}
},
{
"type": "ACCUMULATE_POINTS",
"accumulate_points": {
"loyalty_program_id": "PROGRAM_ID",
"points": 12,
"order_id": "ORDER_ID"
}
}
]
}
Because no reward is returned by SearchLoyaltyRewards and the REDEEM_REWARD event has no reward_id, we have no reliable way to attribute the redeemed points to the order.
Questions
- The customer used the standard “redeem a reward” flow at the POS, and a redemption clearly occurred (the balance dropped by the redeemed points). What could be the reason the API returns this abnormal response?
- When a
REDEEM_REWARDevent has noreward_id, how can we determine how many points were redeemed for that specific order via the API? - Is there a better way to derive used points for a order?
Environment
- Region: Japan
- API: Loyalty API (Square Connect v2)
- The seller has an active Square Loyalty subscription.
- We can share the specific
loyalty_account_id/order_idprivately if needed.