Redeem
export PASSKAAR_API=https://api.passkaar.com/integrations/v1printf 'Your key: '; read -rs PASSKAAR_KEY; echo; export PASSKAAR_KEYCARD=$(cat card.json); RUN=$(date +%s); echo "INV-$RUN-2" | tee invoice-2.txtThe right order
Section titled “The right order”- Finish the bill. All items and the shop’s own discounts are on it.
- Redeem with
POST /redemptions, just before taking the money. It spends at once, so do it when the customer has said yes. - Take the discount off only when the answer says so. No answer, no discount.
- Take the payment.
- Add with
POST /awards, for what the customer paid after the discount.
The API takes the two calls in either order. Redeem goes first because its answer decides the bill, and so
that the customer does not spend what this same bill earns. Both calls may carry the same invoice
number, because adding and redeeming are counted apart. Each has its own Idempotency-Key.
Points for money off
Section titled “Points for money off”Invoice 2 comes to Rs 1,200 and Ayesha uses 100 beans:
INVOICE=$(cat invoice-2.txt)curl -sS "$PASSKAAR_API/redemptions" \ -H "Authorization: Bearer $PASSKAAR_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d "{\"card\": $CARD, \"reference\": \"$INVOICE\", \"spend\": {\"type\": \"points\", \"points\": 100}}" | jq .{ "id": "365cf5f1-f646-4470-94aa-e6bfd6867c70", "reference": "INV-1795596398-2", "card": { "id": "7ded17c2-4c34-45ff-925f-548564d12560", "card_id": "GB9-564-1YJ" }, "type": "points", "spent": { "points": 100, "value_rupees": 100 }, "balance": { "type": "points", "points": 195, "unit_name": "beans", "next_reward": null, "expiring": null }, "occurred_at": "2026-11-25T08:46:40.503Z", "recorded_at": "2026-11-25T08:46:40.503Z", "replayed": false}value_rupees is the discount: take Rs 100 off. She pays Rs 1,100, and that is what earns:
curl -sS "$PASSKAAR_API/awards" \ -H "Authorization: Bearer $PASSKAAR_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d "{\"card\": $CARD, \"reference\": \"$INVOICE\", \"bill\": {\"total\": 1100, \"currency\": \"PKR\"}}" | jq '{reference, earned, balance}'{ "reference": "INV-1795596398-2", "earned": { "points": 110 }, "balance": { "type": "points", "points": 305, "unit_name": "beans", "next_reward": null, "expiring": null }}The API does not see the bill when points are spent, so your till sets the limit: never more points
than the bill is worth. Offer the smaller of the balance and bill ÷ rupees_per_point, and not less than
the rules’ min_points.
Every kind of card
Section titled “Every kind of card”| Card | spend |
Then your till |
|---|---|---|
| Points, money off | {"type": "points", "points": 100} |
Takes spent.value_rupees off. The rules’ spend.mode is cash. |
| Points, reward list | {"type": "reward", "reward": "REWARD_KEY"} |
Gives that item free. spend.mode is catalogue, and the key and its cost are in spend.rewards. |
| Points, shop decides | {"type": "points", "points": 100} |
Gives what the shop promises. spend.mode is free. |
| Stamps | {"type": "reward"} |
Gives the rules’ reward, when rewards_ready is 1 or more. |
| Prepaid | {"type": "deduction", "amount": 450} |
Counts Rs 450 as paid, like a payment method. Short? Deduct what there is and take the rest in cash. |
| Coupon | {"type": "coupon"}, and send the bill |
Gives the rules’ offer. The bill is checked against min_spend. |
| Membership pack | {"type": "session"} |
Gives one session. If the rules list services, add "service": "SERVICE_KEY". |
| VIP, membership by time | Nothing to redeem | Gives the level’s perks, or lets the member in (a check-in records the visit). |
A stamps reward, as a full body:
{ "card": { "serial": "THE-SCANNED-SERIAL" }, "reference": "INV-1044", "spend": { "type": "reward" }}Not enough on the card
Section titled “Not enough on the card”curl -sS "$PASSKAAR_API/redemptions" \ -H "Authorization: Bearer $PASSKAAR_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d "{\"card\": $CARD, \"reference\": \"$INVOICE-more\", \"spend\": {\"type\": \"points\", \"points\": 5000}}" | jq .{ "type": "https://passkaar.com/developers/errors/insufficient_balance", "title": "The card does not hold enough", "status": 422, "detail": "There aren’t enough points on this card — 305 left.", "code": "insufficient_balance", "request_id": "38853958ee18e9164fea7f0a49a8fa11"}Nothing was spent. Offer less, or go on without it.
By phone number
Section titled “By phone number”A phone number never spends, not even the customer’s own:
curl -sS "$PASSKAAR_API/redemptions" \ -H "Authorization: Bearer $PASSKAAR_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d "{\"card\": {\"phone\": \"$(cat phone.txt)\"}, \"reference\": \"$INVOICE-phone\", \"spend\": {\"type\": \"points\", \"points\": 20}}" | jq '{status, code}'{ "status": 422, "code": "card_required"}Ask the customer to show the card.
Other code |
Means |
|---|---|
operation_not_allowed |
Not for this card: fewer points than min_points, the wrong spend, a bill too small. detail says which. |
daily_cap_reached |
A coupon already used today. |
card_not_active |
The card has ended, or a coupon or membership has not started or has lapsed. |
Next: refunds and mistakes.