☰ Menu · Scans
API reference
Scans
Turn whatever a scanner read into a member and the actions available for them.
POST
/v1/scansScope: members:read or devices:write
Finds the member behind a scanned value and lists what the device can do next. Nothing is earned or spent. Sends the member.scanned event. Returns 404 member_not_found if nothing matches.
- codestring, required
- Exactly what the scanner produced: card number, QR content, Code 128 with or without the
]C1prefix, card page link, or a phone. Line breaks and tabs are stripped. - device_idstring
- Your id of the device, passed through to the event.
curl
curl https://loyaltyfy.io/api/v1/scans \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{ "code": "]C14285324286429\r", "device_id": "door-1" }'Response · 200
{
"object": "scan",
"matched": true,
"matched_by": "4285324286429",
"device_id": "door-1",
"mechanic": "stamps",
"member": {
"object": "member",
"card_number": "4285324286429",
"first_name": "Ana",
"stamps": { "current": 1, "required": 5, "rewards_available": 0 },
...
},
"actions": [
{ "type": "visit", "method": "POST", "path": "/v1/visits" },
{ "type": "transaction", "method": "POST", "path": "/v1/transactions" }
]
}| action.type | Means |
|---|---|
| visit | The program rewards visits: POST /v1/visits is allowed. |
| transaction | A check can be applied with POST /v1/transactions. |
| redeem_reward | A stamp reward is waiting. path is the call to make, available how many. |
| redeem_cashback | There is a balance. max_amount is the balance; the cap per check is redeem_max_percent. |