☰ Menu · Calculate
API reference
Calculate a check
Ask what a check would earn and redeem before the guest pays. Nothing is written.
POST
/v1/checks/calculateScope: transactions:write or devices:write
Applies the same rules as POST /v1/transactions: the guest's level, category rules, the program's share, the venue's limits and holds. Call it as often as the basket changes. Another register could still spend the balance before the check closes; use a hold when that matters.
- memberstring, required
- Card number, scanned value, serial, member id or phone.
- amountinteger, required
- The check total before cashback, minor units.
- redeem_amountinteger
- How much the guest wants to pay with cashback.
- hold_iduuid
- Calculate as if this hold were captured.
- line_itemsarray
- Same as on a transaction; used by category rules.
curl
curl https://loyaltyfy.io/api/v1/checks/calculate \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{ "member": "2000111703779", "amount": 20000, "redeem_amount": 5000 }'Response · 200
{
"object": "check_calculation",
"amount": 20000,
"redeem_amount": 1250,
"max_redeem": 1250,
"limited_by": "balance",
"net_amount": 18750,
"cashback_earned": 938,
"earn_rate": 5,
"level": "Base",
"balance_after": 938,
"category_rules_applied": false,
"hold_required": false,
"stamps_earned": 0,
"reward_unlocked": false,
"member": { "object": "member", ... },
"display": {
"cashier_text": "Paid with cashback: 12.50 MDL · Cashback earned: 9.38 MDL · Cashback balance: 9.38 MDL",
"receipt_lines": [
"Paid with cashback: 12.50 MDL",
"Cashback earned: 9.38 MDL",
"Cashback balance: 9.38 MDL"
]
}
}- redeem_amountinteger
- What would actually be redeemed.
- max_redeeminteger
- The most this check can redeem now.
- limited_bystring or null
- When the request asked for more:
balance,program,per_checkorper_day. - cashback_earned, earn_rate, level
- What the check would earn and at which level.
- balance_afterinteger
- The balance after this check.
- hold_requiredboolean
- The venue redeems only through holds and no
hold_idwas sent. - stamps_earned, reward_unlocked, discount_percent
- For stamp and visit programs.
- displayobject
cashier_textandreceipt_linesin the guest's language.