CartirraAPI
Get API keys

Webhooks

Webhooks

Cartirra posts signed events to your endpoint when orders, payments, refunds, payouts and customers change. Verify, deduplicate, answer fast.

Instead of polling, let Cartirra tell your server when something happens. Add an endpoint under Developers → Webhooks in the dashboard. Each mode (test and live) has one endpoint and its own signing secret (whsec_…).

Events

EventSent when
order.createdAn order is placed (its payment succeeded)
order.updatedAn order's status, payment status or details change
payment.succeededA payment completes
payment.failedA payment fails
payment.expiredA payment window closes unpaid
refund.succeededA refund reaches the shopper
refund.failedA refund can't be completed
payout.paidA payout lands in your bank account
payout.failedA payout fails and the money returns to your balance
customer.createdA shopper agrees to share their details with you, or a guest places their first order
customer.updatedA shopper's shared name, email or phone changes
customer.consent_revokedA shopper stops sharing their details with you: delete any copies of their email and phone you keep
bill.openedPay at table: a bill is opened for a table
bill.updatedA bill's total, split or note changes, or money paid outside Cartirra is recorded
bill.payment_receivedA guest's payment toward a bill arrives
bill.closedA bill is fully paid, or a manager closes it
bill.voidedA bill is voided
order.issue_reportedA shopper reports a problem with an order
order.issue_updatedA problem report is reviewed, resolved, rejected or withdrawn, or a refund is linked to it
warranty.createdA warranty is created: from a checkout line when the order is paid, or added afterwards
warranty.updatedA warranty's serial number, dates or terms change
warranty.voidedA warranty is voided
webhook.testYou press Send test event in the dashboard

The request

Cartirra sends a POST with a JSON body and these headers:

HeaderValue
Cartirra-Signaturet=<unix seconds>,v1=<hex HMAC-SHA256>
Cartirra-Event-IdThe event id, evt_…
Cartirra-Event-TypeFor example order.created
Cartirra-Delivery-IdThis delivery (an event is delivered once per endpoint)
{
  "id": "evt_0193a1b2c3d47e5f8a9b0c1d2e3f4a5b",
  "object": "event",
  "type": "order.created",
  "livemode": false,
  "created": "2026-10-24T09:30:00.000Z",
  "data": { "object": { "id": "ord_0193a1b2c3d47e5f8a9b0c1d2e3f4a5b", "reference": "ORD-1042" } }
}

data.object is the resource as it was when the event happened. Each event's page in the reference shows its full payload.

Verify the signature

Always verify before trusting a webhook. The signature is an HMAC-SHA256, keyed with your endpoint's whsec_ secret, of the string <t>.<raw request body>.

  1. Read the raw body exactly as received. Parsing and re-serialising the JSON changes it and breaks the signature.
  2. Split Cartirra-Signature into t and v1.
  3. Reject the request if t is more than 5 minutes from now (replay protection).
  4. Compute the HMAC and compare it with v1 in constant time.
import crypto from 'node:crypto';
import express from 'express';

const app = express();
const secret = process.env.CARTIRRA_WEBHOOK_SECRET; // whsec_…

function verify(rawBody, header, toleranceSeconds = 300) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
  const timestamp = Number(parts.t);
  if (!timestamp || Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) return false;
  const expected = crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
  const given = Buffer.from(parts.v1 ?? '', 'hex');
  return given.length === 32 && crypto.timingSafeEqual(given, Buffer.from(expected, 'hex'));
}

app.post('/webhooks/cartirra', express.raw({ type: 'application/json' }), (req, res) => {
  if (!verify(req.body.toString('utf8'), req.get('Cartirra-Signature') ?? '')) return res.sendStatus(400);
  const event = JSON.parse(req.body.toString('utf8'));
  res.sendStatus(200); // answer first, then do the work
  queue.add(event); // e.g. fulfil the order in a background job
});
<?php
$secret = getenv('CARTIRRA_WEBHOOK_SECRET'); // whsec_…
$payload = file_get_contents('php://input');
$header = $_SERVER['HTTP_CARTIRRA_SIGNATURE'] ?? '';

parse_str(str_replace(',', '&', $header), $parts);
$timestamp = (int) ($parts['t'] ?? 0);
$expected = hash_hmac('sha256', $timestamp . '.' . $payload, $secret);

if (!$timestamp || abs(time() - $timestamp) > 300 || !hash_equals($expected, $parts['v1'] ?? '')) {
    http_response_code(400);
    exit;
}

$event = json_decode($payload, true);
http_response_code(200);
// handle $event['type'] …

Answer quickly

Return any 2xx within 10 seconds. Anything else, including a timeout or a redirect, counts as a failure. Do slow work (sending emails, calling other services) after responding, in a background job.

Retries

A failed delivery is retried up to 8 times with exponential backoff, starting at 10 seconds (10 s, 20 s, 40 s and so on), for about 21 minutes in all. After that the delivery is marked failed and your team gets a dashboard notification. You can resend any event from Developers → Webhooks → Events in the dashboard.

Duplicates and order

  • Expect duplicates. A retry can arrive after your server already handled the event (for example if your 2xx was lost). Store each id you've processed and skip repeats.
  • Don't rely on order. Events can arrive out of order. When the order matters, read the current state from the API, for example GET /v1/orders/{id}, instead of applying the event's snapshot blindly.

Catch up on missed events

GET /v1/events lists every event for your business and mode, newest first, and GET /v1/events/{id} shows an event with its delivery attempts. Use them to reconcile after an outage on your side.

Security checklist

  • Use an https:// URL. Live endpoints can't point at private or local addresses.
  • Verify every signature, and reject old timestamps.
  • Keep the whsec_ secret on your server; rotate it from the dashboard if it leaks.
  • Treat the payload as a hint, and read amounts and statuses from the API before you act on anything money-related.