Signing a customer up
A customer joins a shop’s program once. Your system sends their answers to the program’s form, and Passkaar makes the customer and their card at once and answers with a claim link. The customer opens the link on their phone and adds the card to Apple Wallet or Google Wallet with one tap; they fill in nothing. The card can earn straight away, before it is on a phone.
Sign a customer up only when they asked for the card: a tap on your store’s Add to wallet button, or a yes at your till. Never sign up a list of customers.
export PASSKAAR_API=https://api.passkaar.com/integrations/v1printf 'Your key: '; read -rs PASSKAAR_KEY; echo; export PASSKAAR_KEYPROGRAM=$(curl -sS "$PASSKAAR_API/programs" -H "Authorization: Bearer $PASSKAAR_KEY" | jq -r '.data[0].id')Sign up at the counter
Section titled “Sign up at the counter”answers uses the key of each question in the program’s form. Send at least the first name
and the field marked dedupe_key (here, the phone number). A required question you leave out is
asked on the claim page.
A phone number joins a program once, so this guide makes up a new one from the clock each time you run it, and you can run it again on the same test shop. Any Pakistani mobile number you make up works; a test shop holds at most 100 customers and signs up 20 an hour.
PHONE=0300$(date +%s | tail -c 8); echo "$PHONE"curl -sS "$PASSKAAR_API/enrolments" \ -H "Authorization: Bearer $PASSKAAR_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d "{\"program\": \"$PROGRAM\", \"answers\": {\"first_name\": \"Ayesha\", \"phone\": \"$PHONE\"}}" \ | tee enrolment.json | jq .201 Created:
{ "result": "created", "customer": { "id": "6824ad24-355d-49fd-8360-2a821d861384", "external_id": null }, "card": { "id": "8a851af1-d5e8-463a-9354-69e605e01879", "card_id": "GB9-NND-YFC", "in_wallet": false, "claimable": true }, "claim": { "url": "https://passkaar.com/c/amyyL4hYVFxHq0ZRvc65nfdh5cWPKC87L27IhveAMNs", "expires_at": "2026-11-29T02:47:58.937Z" }}What came back:
card.idis the card’s id in the API. Keep it with your customer.card.card_idis the card ID printed under the card’s QR code, likeGB9-Y2Z-H6B. A customer can read it out at a till, and the counter guide uses it.claim.urlis the link for the customer’s phone. It works for seven days and stops working once the card is in a wallet. At a till, show it as a QR code for the customer to scan; online, send the customer’s browser to it. On a computer, the page shows its own QR code to carry on on the phone.
This test shop gave Ayesha 50 beans for joining; a shop sets its own welcome. The welcome is in
the card’s balance and its history from the start, and sends no award.created event: a webhook
receiver learns of the card from card.created and reads the balance with
Get a card.
Keep the card ID for the next guide:
CARD_ID=$(jq -r '.card.card_id' enrolment.json); echo "$CARD_ID"Someone who already has the card
Section titled “Someone who already has the card”A phone number joins a shop’s program once. Send the same person again and nothing new is made:
curl -sS "$PASSKAAR_API/enrolments" \ -H "Authorization: Bearer $PASSKAAR_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d "{\"program\": \"$PROGRAM\", \"answers\": {\"first_name\": \"Ayesha\", \"phone\": \"$PHONE\"}}" | jq .200 OK:
{ "result": "already_member", "customer": { "id": "6824ad24-355d-49fd-8360-2a821d861384", "external_id": null }, "card": { "id": "8a851af1-d5e8-463a-9354-69e605e01879", "card_id": null, "in_wallet": false, "claimable": true }, "claim": { "url": "https://passkaar.com/c/xy4dxULwBTAf6em2lFRyN5bKlVV4e9WvhT51oRi1GJc", "expires_at": "2026-11-29T02:48:02.379Z" }}already_member is a success, not an error. Two things differ from a new sign-up:
card_idisnull. A phone number alone is not proof of holding the card, so the API does not hand out its printed ID.claimis there only because your connection made this card and it has never been in a wallet. If someone else made it, or it has been on a phone,claimisnull: a customer who lost their phone gets their card back from the shop’s cashier, never from a link.
Sign up for an online store
Section titled “Sign up for an online store”An online store has its own id for each customer account. Send it as external_id, and you can
later give and spend on the card by that id instead of asking for a phone number. An external_id
belongs to one customer, so this one is made up from the clock too, as is Bilal’s phone number:
STORE_CUSTOMER=store-customer-$(date +%s); PHONE_2=0301$(date +%s | tail -c 8)curl -sS "$PASSKAAR_API/enrolments" \ -H "Authorization: Bearer $PASSKAAR_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d "{\"program\": \"$PROGRAM\", \"answers\": {\"first_name\": \"Bilal\", \"phone\": \"$PHONE_2\", \"email\": \"bilal@example.com\"}, \"external_id\": \"$STORE_CUSTOMER\"}" \ | tee enrolment-online.json | jq .{ "result": "created", "customer": { "id": "b704e4c6-f6c9-49ac-bd79-6692683c4a31", "external_id": "store-customer-1795315683" }, "card": { "id": "6eec7c6a-8f73-4a25-8f0a-468b96fcd96b", "card_id": "GB9-GB9-W9G", "in_wallet": false, "claimable": true }, "claim": { "url": "https://passkaar.com/c/U0NA4fcTWrgNWzbhJvyX-8t-47Gx0C4UYL1yVety32c", "expires_at": "2026-11-29T02:48:04.450Z" }}The next guides read card.card_id from enrolment.json and customer.external_id from
enrolment-online.json, so run them in the same folder. Redirect the customer’s browser to
claim.url. Because your connection made this card for this store account, the account may also spend it at your checkout, which the
online order guide does.
A customer who already holds the card from the shop’s counter is already_member, and linking by
phone lets the account earn but not spend. To spend too, the customer proves the card with its card
ID and their phone or email, through POST /cards/link.
When the card is added
Section titled “When the card is added”When the customer adds the card to their phone, Passkaar sends your server a card.claimed
webhook, and in_wallet on the card turns true. A
link that ran out of time can be renewed with
POST /cards/{id}/claim-link while the card has never been on a
phone.
Next: a sale at the counter.