Tavolo Plus DevelopersAPI referenceConsole
Docs menu
Guide

Retries and references

Networks fail. Retrying a purchase must never give a customer two stamps. The reference you send makes every retry safe.

Your reference

Every purchase and redemption carries a reference: your order number for purchases, any unique string for redemptions (1 to 128 letters, digits or . _ : -). References are unique per brand and per endpoint, so an order number can be used once for its purchase and once for its redemption.

You sendWe answer
A new referenceThe new purchase or redemption
The same reference with the same bodyThe first answer again, same status, with the header Idempotent-Replayed: true. Nothing is credited twice.
The same reference with a different body409 REFERENCE_REUSED
A reference of a customer you deleted410 CUSTOMER_DELETED

Bodies are compared after normalising key order and whitespace, so re-encoding the JSON in another language never breaks a retry. References are kept for the life of the brand: an order can never be credited twice, even years later.

When to retry

  • Timeouts, connection errors, 5xx: retry with the same reference and body, with backoff (1 s, 2 s, 4 s…).
  • 429 RATE_LIMITED: wait the seconds in Retry-After.
  • Other 4xx: do not retry unchanged; fix the request (the error code says what).

Reversals

POST /v1/purchases/{id}/reverse undoes one purchase (refund, cancelled order) and needs no reference: a second call returns the first result with Idempotent-Replayed: true. If the customer already used the reward that stamp went into, you get 409 ALREADY_REDEEMED; for points already spent, 409 INSUFFICIENT_BALANCE.

Request ids

Every response has an X-Request-Id header and every error a requestId field. Send your own X-Request-Id (1 to 64 characters) to tie our logs to yours; we echo it. Quote it when you write to support.