Esenda
Embedded Checkout

Webhooks

Receive payment event notifications for embedded checkout

If a notification_url is provided in the checkout session request, esenda sends the order.updated webhook when the payment completes, the checkout expires, or a refund succeeds or fails. The event includes the order's line items and refunds.

The webhook is signed with HMAC-SHA-512 in the X-Hmac-Signature header. Esenda retries up to five times and expects a 200 OK response.

Webhook Payload

{
  "created_at": "2026-11-05T10:14:00Z",
  "data": {
    "order_id": "ord_7d41",
    "external_id": "INV-10432",
    "store_id": "a7881587-55e5-4a39-b75f-cfc5b39de5c3",
    "status": "partially_refunded",
    "line_items": [
      {
        "line_item_id": "li_8f2a",
        "external_id": "INV-10432-1"
      },
      {
        "line_item_id": "li_8f2b",
        "external_id": "INV-10432-2"
      }
    ],
    "refunds": [
      {
        "refund_id": "rf_2c11",
        "amount": 10000
      }
    ],
    "payments": [
      {
        "payment_id": "cb03882b-25a0-45e8-b6f1-aa5cd303f88d",
        "amount": 100,
        "payment_method": "open_banking",
        "status": "success"
      }
    ]
  },
  "event_type": "order.updated",
  "id": "36bd6eea-9bad-4101-b3de-35389d348f9f",
  "shortcode": "test-school"
}

Payload Fields

FieldDescriptionExample
created_atISO 8601 event timestamp2026-11-05T10:14:00Z
dataOrder object with the same fields as the Orders ListSee example above
data.order_idOrder identifierord_7d41
data.store_idThe store this order belongs to.a7881587-55e5-4a39-b75f-cfc5b39de5c3
data.external_idPartner's order identifier, if suppliedINV-10432
data.line_itemsOrder line items. Each contains only line_item_id and external_id.Array
data.refundsSuccessful refunds, oldest first. Each contains only refund_id and amount. Empty when there are none.Array
data.paymentsPayments associated with the order, each with a payment_id, amount, payment_method and statusArray
data.statusOrder statuscreated, completed, expired, refunded, partially_refunded
event_typeWebhook event typeorder.updated
idUnique webhook identifier (UUID)UUID
shortcodeOrganisation shortcodeexample-school

HMAC Signature Verification

All webhooks include an X-Hmac-Signature header. Use the webhook HMAC shared secret provided by Esenda with SHA-512 to verify authenticity.

Webhook Headers

Content-Type:      application/json
X-Hmac-Signature:  <hmac_signature>

Validation Example (Python)

import hashlib
import hmac
import json

secret_key = SECRET_KEY_PROVIDED_BY_ESENDA

# Serialize the webhook body to a canonical JSON string
data_json = json.dumps(webhook_message, sort_keys=True, separators=(",", ":"))

# Calculate the HMAC-SHA-512 signature
expected_signature = hmac.new(
    secret_key.encode("utf-8"), data_json.encode("utf-8"), hashlib.sha512
).hexdigest()

# Compare signatures securely
signatures_match = hmac.compare_digest(expected_signature, received_signature)

On this page