Skip to content

delivery_order/cancelled

Overview

PropertyValue
Webhook typedelivery_order/cancelled
Kafka topicdelivery-order.cancelled
DirectionPlatform → Your endpoint

Description

Fired when a delivery order is cancelled. Cancellation may be initiated by an operator, the customer, or automatically by the system (e.g. due to persistent stock unavailability or warehouse rejection).

Trigger Conditions

  • An operator cancels the delivery order via the GraphQL API
  • The system automatically cancels after a warehouse permanently rejects fulfillment
  • The parent order is cancelled while this delivery order is in a non-terminal state
  • All delivery order lines transition to CANCELED status

Message Envelope

json
{
  "header": {
    "organizationId": "org_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "messageId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "webhookId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "type": "delivery_order/cancelled",
    "date": "2024-03-15T14:00:00.000Z"
  },
  "body": { ... }
}

Body — Property Table

The body has the same shape as delivery_order/created. See delivery-order-created.md for the full property table.

When this event fires, lines typically have:

FieldExpected value
lines[].statusCANCELED for all cancelled lines

The events array will typically include a CANCELED fulfillment event.

Full JSON Payload Sample

json
{
  "header": {
    "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "messageId": "b8c9d0e1-f2a3-4567-bcde-234567890123",
    "webhookId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
    "type": "delivery_order/cancelled",
    "date": "2024-03-15T14:00:00.000Z"
  },
  "body": {
    "id": "e5f6a7b8-c9d0-1234-efab-890123456789",
    "orderIds": ["d4e5f6a7-b8c9-0123-defa-234567890123"],
    "locationId": "f0a1b2c3-d4e5-6789-f0ab-123456789012",
    "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "shippingMethodId": "f6a7b8c9-d0e1-2345-fabc-456789012345",
    "shippingMethodName": "Colissimo Domicile",
    "collectPointId": null,
    "collectPointCountry": null,
    "collectPointZipCode": null,
    "type": "B2C",
    "priority": "NORMAL",
    "issuedAt": "2024-03-15T09:00:00.000Z",
    "status": "OPENED",
    "fulfillmentType": "WAREHOUSE",
    "total": 85.00,
    "totalTaxInclusive": 102.00,
    "totalShipping": 5.99,
    "totalDiscount": 0.00,
    "totalVat": 17.00,
    "totalInsurance": null,
    "currency": "EUR",
    "invoiceNumber": "INV-2024-001234",
    "invoiceUrl": null,
    "orderNumber": "ORD-2024-001234",
    "gift": false,
    "inventoryPolicy": "DENY",
    "createdAt": "2024-03-15T10:30:00.000Z",
    "prepareAt": null,
    "comment": "Cancelled: insufficient stock",
    "meta": null,
    "incoterms": null,
    "virtual": false,
    "deliveryAddress": {
      "id": "a1b2c3d4-e5f6-7890-abcd-901234567890",
      "type": "PERSON",
      "deliveryOrderId": "e5f6a7b8-c9d0-1234-efab-890123456789",
      "fullname": "Alice Dupont",
      "email": "alice.dupont@example.com",
      "address": "12 Rue de la Paix",
      "addressComplement": null,
      "zipcode": "75001",
      "country": "FR",
      "city": "Paris",
      "state": null,
      "phone": "+33612345678",
      "comments": null,
      "metadata": null,
      "taxId": null,
      "eori": null,
      "form": null,
      "capital": null,
      "companyId": null,
      "registration": null
    },
    "events": [
      {
        "id": "f6a7b8c9-d0e1-2345-fabc-012345678901",
        "deliveryOrderId": "e5f6a7b8-c9d0-1234-efab-890123456789",
        "type": "INSUFFICIENT_STOCK",
        "level": "ERROR",
        "message": "SKU TSHIRT-WHITE-M: 0 units available, 2 required",
        "date": "2024-03-15T13:45:00.000Z"
      },
      {
        "id": "a7b8c9d0-e1f2-3456-abcd-345678901234",
        "deliveryOrderId": "e5f6a7b8-c9d0-1234-efab-890123456789",
        "type": "CANCELED",
        "level": "WARNING",
        "message": "Delivery order cancelled due to insufficient stock",
        "date": "2024-03-15T14:00:00.000Z"
      }
    ],
    "lines": [
      {
        "id": "b2c3d4e5-f6a7-8901-bcde-012345678901",
        "deliveryOrderId": "e5f6a7b8-c9d0-1234-efab-890123456789",
        "orderLineId": "c9d0e1f2-a3b4-5678-cdef-789012345678",
        "stockReferenceId": "d0e1f2a3-b4c5-6789-defa-123456789012",
        "status": "CANCELED",
        "label": "T-Shirt Blanc Taille M",
        "sku": "TSHIRT-WHITE-M",
        "quantity": 2,
        "price": 25.00,
        "vatRate": 0.20,
        "total": 50.00,
        "totalTaxInclusive": 60.00,
        "meta": null,
        "fulfilledQuantity": 0
      }
    ]
  }
}

Notes

  • delivery_order/cancelled is a terminal event for the delivery order.
  • The cancellation reason is typically visible in the comment field and/or in the events array (look for INSUFFICIENT_STOCK, FULFILLMENT_REJECTED, or CANCELED events).
  • When a delivery order is cancelled, the associated order lines may be re-dispatched to a different location (a new delivery order will be created).
  • Both delivery_order/cancelled and delivery_order/updated are emitted simultaneously.

HappyColis API Documentation