OuiPay
Webhooks

Verification

Verify X-OuiPay-Signature on every webhook delivery.

Signature = hex HMAC-SHA256 of {timestamp}.{raw_body} using the subscription signing secret.

Headers

HeaderValue
X-OuiPay-TimestampUnix seconds
X-OuiPay-SignatureHex digest (no sha256= prefix)
X-OuiPay-Delivery-IdUnique delivery id

Steps

  1. Read the raw request body bytes (do not re-serialize JSON first).
  2. Reject if the timestamp is too old (for example older than 5 minutes).
  3. Compute HMAC_SHA256(secret, "{timestamp}.{body}") as lowercase hex.
  4. Compare to X-OuiPay-Signature with a constant-time equality check.
  5. Deduplicate on X-OuiPay-Delivery-Id.

Code

# Compute expected signature (hex) from timestamp + raw body file
printf '%s.' "$TIMESTAMP" | cat - ./body.json \
  | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" \
  | awk '{print $2}'

On this page