Core concepts

Webhooks

There are none yet. Here is what to do instead, and what to avoid.

Trovy does not send webhooks yet. This page exists so you do not go looking.

Why you probably do not need them

Almost nothing in this API changes without you having caused it. A reward appears because you called earn; it disappears because you called redeem or refund. The exceptions are time and the till: a reward expires at its expiresAt, a held-back one becomes usable at its usableFrom, and when your program also runs at the till a customer can spend a reward in the shop. Every one of those calls returns the new state in its own response:

  • earn returns the reward it created or stacked onto.
  • redeem returns how much came off and any new reward.
  • refund returns what was clawed back.

So the state you would have waited for a webhook to learn is already in the response you are holding.

Do not poll

Apart from those, no answer changes on its own, so a polling loop spends your rate limit to learn nothing. Read a customer's rewards at the moment you are about to show or spend them — which is also when the answer actually matters, since a reward can be redeemed at the counter between any two of your reads.

The one thing you cannot currently observe

A customer earning or redeeming in the shop, at the till, rather than through your app. It happens only when the business runs your program at its till as well (see Going live). Your copy of their reward balance goes stale at that moment, and there is no event to tell you.

The answer for now is not to keep a copy. Read rewards.list(customerId) when you render a basket or apply a reward, and treat a 409 on redeem as what it is: somebody got there first. The API is the source of truth and it is one call away.

When they arrive

When webhooks ship they will be signed, retried with backoff, and delivered at-least-once — so your handler will need to be idempotent on the event id. The changelog will say so, and this page will be replaced with the real thing.

If an event would unblock something specific for you, email developers@trovy.ca and say which one. That is how it gets prioritized.