Complyance Logo

Payload and Delivery

When a purchase invoice webhook event occurs, Complyance sends a POST request to your configured endpoint with a JSON payload and delivery metadata in the request headers.

Event Payload Example

{
  "data": {
    "id": "purchase:01HABC123DEF456",
    "type": "purchase.invoice.stored",
    "timestamp": "2026-05-26T07:04:01.550Z",
    "data": {
      "documentId": "01JABCDEFGHIJKLMNOPQRSTUV",
      "documentNumber": "INV-2026-001",
      "documentType": "tax_invoice",
      "country": "AE",
      "totalAmount": 105.0,
      "currency": "AED",
      "sellerName": "Acme Supplies LLC",
      "issueDate": "2026-05-20",
      "submittedAt": "2026-05-26T07:04:01.550Z"
    },
    "metadata": {
      "requestId": "01JABCDEFGHIJKLMNOPQRSTUV",
      "sourceId": null
    }
  },
  "eventId": "purchase:01HABC123DEF456"
}

Core Payload Fields

FieldTypeDescription
data.data.documentIdstringUnique document identifier for the purchase invoice
data.data.documentNumberstringSupplier-provided invoice or document number
data.data.documentTypestringDocument type such as tax_invoice or credit_note
data.data.countrystringCountry code such as AE, SA, MY, DE, or BE
data.data.totalAmountnumberTotal invoice amount including tax
data.data.currencystringISO 4217 currency code such as AED, SAR, MYR, or EUR
data.data.sellerNamestringSeller or supplier name
data.data.issueDatestringInvoice issue date
data.data.errorsarray or omittedPresent for validation-failed events and omitted for stored-success events
data.data.submittedAtstringTimestamp when the invoice entered the receiving flow
data.idstringUnique event identifier, same value as eventId
data.typestringEvent type
data.timestampstringTimestamp when the business event was created
eventIdstringUnique business event identifier used for deduplication

Delivery Headers

HeaderDescription
Content-TypeAlways application/json
X-Webhook-IDUnique business event identifier, same as eventId
X-Webhook-TimestampTimestamp for the specific delivery attempt
X-Webhook-SignatureHMAC signature when signing is enabled
X-Webhook-EventEvent type such as purchase.invoice.stored

Timestamp Semantics

There are two timestamps worth treating differently:

  • data.timestamp: when the business event itself was created
  • X-Webhook-Timestamp: when this specific delivery attempt was sent

These values may differ when the platform retries delivery.

Deduplication Guidance

Use eventId or X-Webhook-ID as your business event deduplication key. The same identifier is reused across retries for the same underlying event, so it is the right value to persist for idempotent processing.

Do not infer meaning from the structure of the event ID. Treat it as an opaque identifier.

When your endpoint receives a webhook:

  1. Read the raw request body
  2. Verify the signature if signing is enabled
  3. Confirm the event has not already been processed
  4. Persist the event or enqueue internal processing
  5. Return a success response promptly

Practical Handling Notes

  • Expect retries and make processing idempotent
  • Log the event type and event ID for troubleshooting
  • Separate transport success from business processing where possible
  • Use purchase.invoice.validation_failed to trigger exception workflows or manual review