Skip to content

Add points, stamps or money

One call records a sale: POST /awards. Send it when the bill is paid, not when it is opened.

Every guide starts here
export PASSKAAR_API=https://api.passkaar.com/integrations/v1
printf 'Your key: '; read -rs PASSKAAR_KEY; echo; export PASSKAAR_KEY

Your till sends its own invoice number as reference. Here one is made from the clock, so you can run the page again:

Terminal window
CARD=$(cat card.json); RUN=$(date +%s); echo "INV-$RUN-1" | tee invoice-1.txt

You send the bill, and Passkaar works out the points:

Terminal window
INVOICE=$(cat invoice-1.txt); KEY=$(uuidgen)
curl -sS "$PASSKAAR_API/awards" \
-H "Authorization: Bearer $PASSKAAR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $KEY" \
-d "{\"card\": $CARD, \"reference\": \"$INVOICE\", \"bill\": {\"total\": 2450, \"tax\": 350, \"currency\": \"PKR\"}}" | jq .

201 Created:

{
"id": "da5a0ed7-1c76-4190-894c-5b71c1cc058c",
"reference": "INV-1795596390-1",
"card": {
"id": "7ded17c2-4c34-45ff-925f-548564d12560",
"card_id": "GB9-564-1YJ"
},
"type": "points",
"earned": {
"points": 245
},
"balance": {
"type": "points",
"points": 295,
"unit_name": "beans",
"next_reward": null,
"expiring": null
},
"rewards_unlocked": [],
"tier_reached": null,
"occurred_at": "2026-11-25T08:46:32.755Z",
"recorded_at": "2026-11-25T08:46:32.755Z",
"replayed": false
}

Print earned and balance on the receipt.

Field What to send
card The serial, card ID or phone number, as on the last page.
reference Your invoice number: 1 to 64 English letters, numbers and signs, no spaces. Never reuse one.
bill.total What the customer pays, after discounts, with tax in it. Whole rupees: round Rs 2,450.50 yourself.
bill.tax The tax inside total (optional). delivery works the same way. They matter only if the shop earns before tax and delivery.
bill.currency Always "PKR".
branch The branch’s id from GET /branches, so the shop’s reports show where (optional). A key made for one branch fills it in by itself.
note A few words for the card’s history, such as the counter’s name (optional).
Idempotency-Key A new UUID for each new request, kept with it until you have an answer. Bad internet says why.

Numbers are JSON numbers (2450, not "2450"), and a field the API does not know is refused, so do not add your own.

A stamps card does not count from the bill. Your till says how many stamps, as the shop’s rule goes (one a visit, one a coffee), and sends the bill too, so a part refund can be worked out later. Send the same call with this body:

{
"card": { "serial": "THE-SCANNED-SERIAL" },
"reference": "INV-1043",
"give": { "type": "stamps", "stamps": 1 },
"bill": { "total": 650, "currency": "PKR" }
}

In the answer, earned.stamps is what was given, and balance has stamps, stamps_total and rewards_ready. When the card fills up, rewards_unlocked names the reward: tell the cashier. One call gives at most the rules’ most_per_visit.

Card Body, beside card and reference Notes
Points "bill": {"total": 2450, "currency": "PKR"} Passkaar applies the rate.
Stamps "give": {"type": "stamps", "stamps": 1} and the bill 1 to 30 a call, up to most_per_visit.
VIP (tiers) "bill": {"total": 2450, "currency": "PKR"} Counts a visit or the rupees, as the shop chose. tier_reached in the answer names a new level.
Prepaid top-up "give": {"type": "top_up", "amount": 2000} Take the Rs 2,000 first. Any bonus is in earned.bonus_rupees. The rules’ min_load, max_load and max_balance are the limits.
Membership or pack "give": {"type": "plan", "plan": "PLAN_KEY", "quantity": 1} Renews, or sells a pack of sessions. The key is from the rules’ plans. Using a session is a redemption.
Membership visit "give": {"type": "check_in"} Only where the rules’ check_ins is true.
Coupon Nothing to add A coupon is only redeemed.

Points can also be given by number, for a special offer: "give": {"type": "points", "points": 50}.

Send the call above again. Same invoice, same card: nothing is added, and the first answer comes back with replayed now true.

Terminal window
curl -sS "$PASSKAAR_API/awards" \
-H "Authorization: Bearer $PASSKAAR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $KEY" \
-d "{\"card\": $CARD, \"reference\": \"$INVOICE\", \"bill\": {\"total\": 2450, \"tax\": 350, \"currency\": \"PKR\"}}" | jq '{reference, earned, replayed}'
{
"reference": "INV-1795596390-1",
"earned": {
"points": 245
},
"replayed": true
}

So an invoice number earns once, for ever. This catches developers out in two ways:

  • A corrected bill. Sending INV-1042 again with another total, even under a new Idempotency-Key, does not change it: it answers the first result. Reverse the first and send the corrected bill under a new number.
  • Invoice numbers that start again. A number used for another customer’s card answers reference_reused, and used for the same card it answers the old sale. Add a branch, till or year code.

The sale is still good. Finish it, and show the cashier one line.

Terminal window
curl -sS "$PASSKAAR_API/awards" \
-H "Authorization: Bearer $PASSKAAR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d "{\"card\": $CARD, \"reference\": \"$INVOICE-small\", \"bill\": {\"total\": 5, \"currency\": \"PKR\"}}" | jq .
{
"type": "https://passkaar.com/developers/errors/operation_not_allowed",
"title": "The card's type does not allow this",
"status": 422,
"detail": "Bills under Rs 10 don’t earn a point.",
"code": "operation_not_allowed",
"request_id": "76c2230fec8fb46a536bd07fc1b96efc"
}
code Means
operation_not_allowed Not for this card: the bill is too small to earn, too many stamps at once, or the wrong give for its type. detail says which.
give_required A bill alone, on a card that needs give.
daily_cap_reached, give_limit_reached The card has had its limit for today.
bill_too_large Above the connection’s largest bill. Check the amount; the owner can raise it.
card_not_active The card has ended or cannot be used.
reference_reused This invoice number was used for another card, or, where the shop asks for bill numbers, a cashier already gave for this bill in the Passkaar app.
ambiguous The phone number has more than one card. Add program, or scan the card.

Next: redeem.