Skip to content

PMS integration

server-to-server

One read endpoint to load the member-on-reservation state. Five HMAC-signed webhooks to stay in sync with balance changes. Delivery is best effort, so reconcile with the snapshot.

GET /reservation-snapshot
Returns everything you need to render the in-stay / checkout cash credit UI in a single round trip.
GET /api/v1/loyalty/reservation-snapshot?reservation_id=${reservationId}
Authorization: Bearer ${GUESTMAKER_API_KEY}
Accept: application/json

// reservation_id is the GuestMaker reservation UUID. Scope: guests:read.
// Response (200)
{
  "success": true,
  "data": {
    "reservation": {
      "id": "uuid",
      "source": "direct",                // a string, or null
      "check_in": "2026-06-01",
      "check_out": "2026-06-04"
    },
    "member": {                          // null when the reservation holder is not a member
      "id": "uuid",
      "member_number": "ABC123",
      "points_balance": 12500,
      "lifetime_points": 18000,
      "tier_id": "uuid",                 // null when the member holds no tier
      "email": "guest@example.com",      // the holder's email, or null
      "full_name": "Ana Ruiz"            // or null
    },
    "spendable_points": 9500,            // = points_balance - active holds that have not expired
    "redemption_rate": 100,              // points per EUR 1
    "cash_credit_enabled": true,
    "applicable_surfaces": { "booking_direct": true, "in_stay": true, "checkout": false },
    "active_holds": [                    // the member's 10 latest holds that are active or confirmed
      {
        "hold_id": "uuid",
        "external_reference_id": "BOOK-2026-001",
        "points": 3000,
        "amount_value": 30.00,
        "currency": "EUR",
        "surface": "booking_direct",
        "status": "active",              // "active" or "confirmed"
        "expires_at": "2026-06-01T12:30:00Z",
        "confirmed_at": null             // a timestamp once the hold is confirmed
      }
    ]
  }
}

Use spendable_points when deciding what the member can apply right now. Do not usepoints_balance. Active holds are already subtracted.

Webhook events
Five events, sent as HMAC-signed JSON to the one HTTPS address the program registers. Only the events ticked in the webhook settings are sent.
loyalty.credit.held
{
  "event": "loyalty.credit.held",
  "tenant_id": "uuid",
  "occurred_at": "2026-06-01T10:00:00Z",
  "data": {
    "hold_id": "uuid",
    "member_id": "uuid",
    "points": 3000,
    "amount_value": 30.00,
    "currency": "EUR",
    "surface": "booking_direct",
    "external_reference_id": "BOOK-2026-001",
    "expires_at": "2026-06-01T10:15:00Z"
  }
}
loyalty.credit.confirmed
{
  "event": "loyalty.credit.confirmed",
  "tenant_id": "uuid",
  "occurred_at": "2026-06-01T10:05:00Z",
  "data": {
    "hold_id": "uuid",
    "transaction_id": "uuid",
    "member_id": "uuid",
    "points": 3000,
    "amount_value": 30.00,
    "currency": "EUR",
    "external_reference_id": "BOOK-2026-001"
  }
}
loyalty.credit.released
{
  "event": "loyalty.credit.released",
  "tenant_id": "uuid",
  "occurred_at": "2026-06-01T10:16:00Z",
  "data": {
    "hold_id": "uuid",
    "member_id": "uuid",
    "external_reference_id": "BOOK-2026-001",
    "points": 3000,
    "cause": "expired"   // /credit/release sends only hold_id and external_reference_id (null if you did not send it), with cause "released"
  }
}
loyalty.credit.reversed
{
  "event": "loyalty.credit.reversed",
  "tenant_id": "uuid",
  "occurred_at": "2026-06-02T09:00:00Z",
  "data": {
    "external_reference_id": "BOOK-2026-001",
    "points_restored": 3000   // a repeated reverse call (idempotent replay) sends no event
  }
}
loyalty.balance.changed
{
  "event": "loyalty.balance.changed",
  "tenant_id": "uuid",
  "occurred_at": "2026-06-01T10:05:00Z",
  "data": {
    "member_id": "uuid",
    "new_balance": 9500
  }
}

A delivery that gets no 2xx answer within 15 seconds (a redirect counts as a failure) is retried after 1 minute, 5 minutes, 30 minutes, 6 hours and 24 hours. Every one of those waits runs inside the background task of the request that raised the event, so only the first attempts are dependable: treat delivery as best effort and reconcile with the snapshot endpoint. A retry sends the same body and signature again, so handle every event idempotently.

HMAC signature verification
Verify X-GM-Signature on every inbound webhook. Reject unsigned or mismatched payloads.
// Node.js: verify the X-GM-Signature header on every webhook.
// Its value is "sha256=" followed by the hex HMAC-SHA256 of the raw body.
import crypto from 'node:crypto';

function verifyLoyaltyWebhook(rawBody: string, signature: string, secret: string) {
  const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
  // Constant-time compare to avoid timing side channels.
  const a = Buffer.from(expected, 'utf8');
  const b = Buffer.from(signature, 'utf8');
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

// Express handler
app.post('/webhooks/loyalty', express.raw({ type: 'application/json' }), (req, res) => {
  const signature = req.header('X-GM-Signature') || '';
  if (!verifyLoyaltyWebhook(req.body.toString('utf8'), signature, process.env.LOYALTY_WEBHOOK_SECRET!)) {
    return res.status(401).end();
  }
  const payload = JSON.parse(req.body.toString('utf8'));
  // ... dispatch on payload.event
  res.status(200).end();
});

The signing secret is generated when you save the webhook in Loyalty → Program → Cash credit (PMS webhook). A program has one webhook: every save replaces its address and events and issues a new secret, shown once; from then on deliveries are signed with the new secret. To rotate, save the webhook, add the new secret to your receiver, and keep accepting the old one for a while, because a delivery already waiting for a retry still carries the signature it was first sent with.

Cookie policy