Webhook events
Passkaar tells your server when something happens to the shop’s cards, whoever caused it: your integration, a cashier at the counter, an automation or the customer’s own phone. You add a webhook endpoint (an https address on your server) with POST /webhook-endpoints or in the portal, choose which events it receives, and Passkaar sends each one as a POST with a JSON body.
The same events can be read in order from the event feed, GET /events, which is the way to catch up after your receiver was down.
The events
Section titled “The events”| Event | When |
|---|---|
card.created |
A customer got a new card: signed up through this or another connection, at the shop’s counter, or on the shop’s own join page |
card.claimed |
A wallet started holding the card: the customer added it to Apple Wallet or Google Wallet |
card.removed_from_wallet |
A wallet stopped holding the card: the customer deleted it from Apple Wallet (from the last device that had it) or from Google Wallet |
award.created |
Value was given to a card: stamps, points, a top-up or a check-in |
award.reversed |
An award was taken back, in full or in part: a refund through the API, or a cashier undoing a sale at the counter |
reward.unlocked |
An award made a reward ready: a stamp card filled, or a points card now holding enough for one of its rewards |
redemption.created |
Value was spent from a card: a reward used, points spent or a prepaid deduction, at the counter or through an integration |
balance.expired |
Part of a card’s balance expired under the card’s rules, in the nightly run |
refund.unresolved |
A reversal could not take back everything it should have, because the customer had already spent the value |
customer.erased |
A customer’s personal details were erased at their request, after the shop’s 30 days to take the approval back |
connection.revoked |
The shop removed your connection |
webhook.test |
Someone pressed Test on the endpoint in the portal, or called POST /webhook-endpoints/{id}/test |
hold.created |
Value was reserved against an online order with POST /redemption-holds |
hold.confirmed |
A hold was confirmed: what it reserved was spent, and a redemption.created was written for it |
hold.released |
A hold was released before it was spent, for example because the order was cancelled |
hold.expired |
A hold reached its 15 minutes without being confirmed or released |
The envelope
Section titled “The envelope”Every event follows Standard Webhooks: { "id", "type", "timestamp", "data" }. timestamp is when Passkaar recorded it; a sale recorded late carries its own time in data.occurred_at. Events carry ids and facts only, never a customer’s full phone number or email.
The signature
Section titled “The signature”| Header | What it is |
|---|---|
webhook-id |
The event id; the same on every retry. |
webhook-timestamp |
Unix seconds when this attempt was signed. |
webhook-signature |
Space-separated v1,<base64> HMAC-SHA256 signatures over {webhook-id}.{webhook-timestamp}.{body}; two for 24 hours after a roll. |
Check every event before you trust it:
- Take the endpoint’s signing secret (it starts
whsec_; the part after the prefix is base64). - Join
webhook-id,webhook-timestampand the raw request body with dots:{id}.{timestamp}.{body}. Use the body exactly as received, before any JSON parsing. - Compute HMAC-SHA256 of that string with the decoded secret, and base64 the result.
- Accept the event if it equals any of the
v1,…signatures inwebhook-signature(compare in constant time), and refuse awebhook-timestampmore than five minutes from your clock.
Any Standard Webhooks library does all of this for you.
Delivery
Section titled “Delivery”- Answer with any 2xx within 15 seconds to acknowledge an event. Do the work after answering.
- Anything else is retried: at once, then after 5 seconds, 5 minutes, 30 minutes, 2, 5, 10, 14, 20 and 24 hours, ten attempts over about three days.
webhook-idis the same on every attempt, so use it to ignore an event you already handled. 410 Goneswitches the endpoint off at once. After ten failed attempts with nothing delivered meanwhile, the endpoint is switched off and the shop’s owner is told.- Events are not promised in order. Order by
timestamp, or read the card withGET /cards/{id}when in doubt. - Passkaar sends only to
httpsaddresses on the public internet, follows no redirects, and sends from one fixed address,52.74.164.14, which a firewall in front of your endpoint can allow. The pre-production box sends from an address that can change.