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
| Field | Description | Example |
|---|---|---|
created_at | ISO 8601 event timestamp | 2026-11-05T10:14:00Z |
data | Order object with the same fields as the Orders List | See example above |
data.order_id | Order identifier | ord_7d41 |
data.store_id | The store this order belongs to. | a7881587-55e5-4a39-b75f-cfc5b39de5c3 |
data.external_id | Partner's order identifier, if supplied | INV-10432 |
data.line_items | Order line items. Each contains only line_item_id and external_id. | Array |
data.refunds | Successful refunds, oldest first. Each contains only refund_id and amount. Empty when there are none. | Array |
data.payments | Payments associated with the order, each with a payment_id, amount, payment_method and status | Array |
data.status | Order status | created, completed, expired, refunded, partially_refunded |
event_type | Webhook event type | order.updated |
id | Unique webhook identifier (UUID) | UUID |
shortcode | Organisation shortcode | example-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)