Documentation

Partner Webhook Guide

Audience: partner engineering teams that want to be told, server to server, when a customer has bought and received extras for one of their bookings.

Status: available per brand. Webhooks are switched on for a brand during onboarding, once you have given us an endpoint URL and we have exchanged a shared secret. Until then nothing is sent.


1. Summary

After a customer pays for extras on DepartCart and every item has been confirmed with the airline, DepartCart sends one signed JSON POST to your endpoint describing the sale and each item in it.

Property Value
Method POST
Content type application/json
Event type transaction.processed (the only event today)
Signature HMAC-SHA256 over the timestamp and the raw body, keyed with your shared secret
Success Any 2xx response
Retries None. See section 6

2. When it is sent

  • After fulfilment of a website transaction. The notification is sent after DepartCart has confirmed the items with the airline, so it carries real outcomes, not just a payment. Normally that is once per sale, but a sale can occasionally be notified more than once, so de-duplicate on event_id.
  • Only fully confirmed sales are sent. If any item in a sale is not confirmed, nothing is sent at that point. If our operations team resolves the sale, the notification is sent then, as a completed sale. In practice, fulfilment.status in a notification you receive always reads completed.
  • Paid transactions only. An abandoned or unpaid cart never sends anything.
  • Website sales only. Bookings made through the B2B seat fulfilment API do not send webhooks; that API already returns the outcome in its own response.

3. Example request

POST https://partner.example/hooks/departcart
Content-Type: application/json
User-Agent: DepartCart-Webhook/1
X-DepartCart-Event: transaction.processed
X-DepartCart-Event-Id: evt_2f6c1d9e-7b1a-4c35-9a5e-0d1f4b7c8e21
X-DepartCart-Timestamp: 1794791250
X-DepartCart-Signature: sha256=5d0a1f...e9c4
{
  "event_id": "evt_2f6c1d9e-7b1a-4c35-9a5e-0d1f4b7c8e21",
  "event_type": "transaction.processed",
  "api_version": "2026-11-17",
  "created_at": "2026-11-16T01:07:30Z",
  "transaction": {
    "id": "2f6c1d9e-7b1a-4c35-9a5e-0d1f4b7c8e21",
    "brand": "yourbrand",
    "channel": "web",
    "status": "paid",
    "pnr": "ABCDEF",
    "itinerary_id": "38818134",
    "currency": "AUD",
    "total_amount": "58.00",
    "payment_reference": "QJ7M2KXN4V8T6H5R",
    "created_at": "2026-11-16T01:00:00Z",
    "paid_at": "2026-11-16T01:05:00Z"
  },
  "fulfilment": {
    "status": "completed",
    "items_total": 2,
    "items_confirmed": 2,
    "items_failed": 0
  },
  "items": [
    {
      "item_id": 101,
      "type": "seat_selection",
      "description": "Seat 12A",
      "passenger_id": "1.1",
      "flight": { "carrier": "QF", "number": "QF401", "date": "2026-12-01", "time": "09:30" },
      "seat": "12A",
      "price": "29.00",
      "currency": "AUD",
      "markup_included": "17.00",
      "fulfilment": {
        "status": "completed",
        "airline_confirmation": "XYZ123",
        "fulfilled_at": "2026-11-16T01:06:00Z"
      }
    },
    {
      "item_id": 102,
      "type": "seat_selection",
      "description": "Seat 12B",
      "passenger_id": "1.2",
      "flight": { "carrier": "QF", "number": "QF401", "date": "2026-12-01", "time": "09:30" },
      "seat": "12B",
      "price": "29.00",
      "currency": "AUD",
      "markup_included": "17.00",
      "fulfilment": {
        "status": "completed",
        "airline_confirmation": "XYZ123",
        "fulfilled_at": "2026-11-16T01:06:00Z"
      }
    }
  ]
}

The values above are illustrative. The body is compact JSON with sorted keys; do not rely on key order or whitespace, and always verify the signature over the bytes exactly as received.


4. Fields

Envelope

Field Type Meaning
event_id string evt_ followed by the transaction id. Stable: if the same sale is notified twice, the id is the same. Use it to de-duplicate.
event_type string Always transaction.processed today. Ignore event types you do not recognise.
api_version string Version of this format. Additive changes (new fields) keep the version; a breaking change bumps it.
created_at string When this notification was built, ISO 8601 UTC.

transaction

Field Type Meaning
id string DepartCart's transaction id (a GUID).
brand string Your lower-case brand id.
channel string Always web.
status string Payment status. Always paid in a notification.
pnr string The booking reference the extras were bought against.
itinerary_id string or null Your own itinerary id for the booking, when we could read one from it.
currency string ISO 4217 code of the amount paid.
total_amount string The full amount the customer paid, two decimals.
payment_reference string or null The card payment provider's reference for the payment, when recorded. It is not your itinerary id; use itinerary_id for that.
created_at string or null When the cart was created, ISO 8601 UTC.
paid_at string or null When payment was confirmed, ISO 8601 UTC.

fulfilment

Field Type Meaning
status string completed when every item is confirmed.
items_total integer Number of items in the sale.
items_confirmed integer Items confirmed with the airline.
items_failed integer Items that could not be confirmed.

items[]

Field Type Meaning
item_id integer DepartCart's id for the item, unique within DepartCart.
type string Product type, for example seat_selection.
description string Human-readable label, for example Seat 12A.
passenger_id string or null The passenger number on the booking ("1.1", "1.2"), which you can map to the passengers on your own booking. null when it was not recorded. Passenger names are never sent.
flight.carrier string or null Two-letter airline code.
flight.number string or null Flight number.
flight.date string or null Departure date, YYYY-MM-DD, local to the departure airport.
flight.time string or null Departure time, HH:MM, local to the departure airport.
seat string or null Seat number, for seat items.
price string What the customer paid for this item, two decimals.
currency string ISO 4217 code of price.
markup_included string or null The markup component contained within price, two decimals, or null when not recorded.
fulfilment.status string completed, successful or already_fulfilled all mean the item is confirmed.
fulfilment.airline_confirmation string or null The airline's confirmation for the item, when one exists.
fulfilment.fulfilled_at string or null When the item was confirmed, ISO 8601 UTC.

Money is always a string with two decimals, never a floating point number. Parse it as a decimal.

Not sent: customer contact details, passenger names, payment card data, and DepartCart's internal fulfilment notes.


5. Verifying the signature

Every request is signed with the shared secret agreed at onboarding.

signed_string = X-DepartCart-Timestamp + "." + raw_request_body
signature     = "sha256=" + hex( HMAC-SHA256( key = shared_secret, message = signed_string ) )

To verify a request:

  1. Read the raw request body as bytes, before any JSON parsing. Re-serialising parsed JSON changes the bytes and the signature will not match.
  2. Recompute the signature from X-DepartCart-Timestamp and the raw body.
  3. Compare it with X-DepartCart-Signature using a constant-time comparison.
  4. Reject the request if X-DepartCart-Timestamp (Unix seconds) is more than five minutes from your clock. This stops an old request being replayed.

Python (Flask)

import hashlib
import hmac
import time

from flask import Flask, abort, request

app = Flask(__name__)
WEBHOOK_SECRET = "<SHARED_SECRET>"  # from your secret manager
MAX_SKEW_SECONDS = 300


def signature_is_valid(secret: str, timestamp: str, raw_body: bytes, header: str) -> bool:
    expected = "sha256=" + hmac.new(
        secret.encode("utf-8"),
        timestamp.encode("utf-8") + b"." + raw_body,
        hashlib.sha256,
    ).hexdigest()
    return hmac.compare_digest(expected, header or "")


@app.post("/hooks/departcart")
def departcart_webhook():
    timestamp = request.headers.get("X-DepartCart-Timestamp", "")
    signature = request.headers.get("X-DepartCart-Signature", "")
    raw_body = request.get_data()  # raw bytes, before parsing

    if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > MAX_SKEW_SECONDS:
        abort(400)
    if not signature_is_valid(WEBHOOK_SECRET, timestamp, raw_body, signature):
        abort(401)

    event = request.get_json()
    # De-duplicate on event["event_id"], store it, and process asynchronously.
    return "", 204

Node.js (Express)

const crypto = require("crypto");
const express = require("express");

const app = express();
const WEBHOOK_SECRET = process.env.DEPARTCART_WEBHOOK_SECRET;
const MAX_SKEW_SECONDS = 300;

function signatureIsValid(secret, timestamp, rawBody, header) {
  const expected = "sha256=" + crypto
    .createHmac("sha256", secret)
    .update(timestamp + ".")
    .update(rawBody)
    .digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(header || "");
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

// express.raw keeps the body as the exact bytes that were signed.
app.post("/hooks/departcart", express.raw({ type: "application/json" }), (req, res) => {
  const timestamp = req.get("X-DepartCart-Timestamp") || "";
  const signature = req.get("X-DepartCart-Signature") || "";

  if (!/^\d+$/.test(timestamp) ||
      Math.abs(Date.now() / 1000 - Number(timestamp)) > MAX_SKEW_SECONDS) {
    return res.sendStatus(400);
  }
  if (!signatureIsValid(WEBHOOK_SECRET, timestamp, req.body, signature)) {
    return res.sendStatus(401);
  }

  const event = JSON.parse(req.body.toString("utf8"));
  // De-duplicate on event.event_id, store it, and process asynchronously.
  res.sendStatus(204);
});

C# (ASP.NET Core)

using System.Security.Cryptography;
using System.Text;
using Microsoft.AspNetCore.Mvc;

[ApiController]
[Route("hooks/departcart")]
public class DepartCartWebhookController : ControllerBase
{
    private const long MaxSkewSeconds = 300;
    private readonly string _secret; // from your secret manager

    public DepartCartWebhookController(IConfiguration config) =>
        _secret = config["DepartCart:WebhookSecret"]!;

    [HttpPost]
    public async Task<IActionResult> Receive()
    {
        using var buffer = new MemoryStream();
        await Request.Body.CopyToAsync(buffer);
        var rawBody = buffer.ToArray(); // raw bytes, before parsing

        var timestamp = Request.Headers["X-DepartCart-Timestamp"].ToString();
        var signature = Request.Headers["X-DepartCart-Signature"].ToString();

        if (!long.TryParse(timestamp, out var ts) ||
            Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - ts) > MaxSkewSeconds)
            return BadRequest();
        if (!SignatureIsValid(_secret, timestamp, rawBody, signature))
            return Unauthorized();

        // Deserialize rawBody, de-duplicate on event_id, process asynchronously.
        return NoContent();
    }

    public static bool SignatureIsValid(string secret, string timestamp, byte[] rawBody, string header)
    {
        var prefix = Encoding.UTF8.GetBytes(timestamp + ".");
        var message = new byte[prefix.Length + rawBody.Length];
        Buffer.BlockCopy(prefix, 0, message, 0, prefix.Length);
        Buffer.BlockCopy(rawBody, 0, message, prefix.Length, rawBody.Length);

        using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
        var expected = "sha256=" + Convert.ToHexString(hmac.ComputeHash(message)).ToLowerInvariant();
        return CryptographicOperations.FixedTimeEquals(
            Encoding.UTF8.GetBytes(expected), Encoding.UTF8.GetBytes(header ?? ""));
    }
}

6. Delivery and responses

  • Answer quickly. DepartCart waits about 2 seconds to connect and 3 seconds for a response. Store the event and return 2xx straight away, then do your own processing afterwards.
  • Any 2xx is success. Any other status, a redirect, or a timeout is treated as a failed delivery. Redirects are not followed, so give us the final URL.
  • There are no automatic retries. A failed delivery is logged on our side and is not replayed automatically. If your endpoint was down, tell us which sales you missed and we can re-send them one by one. A re-sent notification is rebuilt from current data, so created_at and the signature will differ from the original, but event_id is the same.
  • De-duplicate on event_id. A sale can occasionally be notified more than once, for example after a manual re-send. Every copy carries the same event_id.
  • HTTPS only. The endpoint must be an https:// URL with a valid certificate.

7. Setting it up

  1. Give us your endpoint URL for each brand, and for each environment you want notifications in (pre-production and production are configured separately).
  2. We generate a shared secret per brand and send it to you over a private channel. Keep it in your secret manager; anyone holding it can sign requests that your endpoint will accept.
  3. We switch the webhook on for your brand. The first real sale on that brand sends the first notification; confirm with us that it arrived and verified.
  4. To rotate a secret, ask us for a new one. Rotation is a coordinated switch, so agree a time with us.

Questions about webhooks go to your DepartCart onboarding contact.