Webhooks
Receive real-time HTTP notifications when events happen in your store.
Webhooks let your application receive real-time POST notifications when events happen in your store — orders placed, products updated, customers created, and more.
When an event fires, CloudCart sends a JSON payload to the URL you registered. Your endpoint should respond with a 2xx status code to acknowledge receipt.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/v2/webhooks | List webhooks |
GET | /api/v2/webhooks/{id} | Get a webhook |
POST | /api/v2/webhooks | Create a webhook |
PATCH | /api/v2/webhooks/{id} | Update a webhook |
DELETE | /api/v2/webhooks/{id} | Delete a webhook |
Properties
| Field | Type | Description |
|---|---|---|
url | string | The endpoint URL that receives the POST request. Must be a valid URL. Required. |
event | string | The event to subscribe to (see Available events). Required. |
active | integer | Whether the webhook is active (1) or disabled (0). |
new_version | integer | Payload format version. 0 = legacy format, 1 = new structured format. See Payload versions. |
request_headers | object | Custom HTTP headers sent with each webhook request (read-only, managed via the admin panel). |
Available events
| Event | Description | Payload docs |
|---|---|---|
order.created | A new order is placed | Order Created |
order.updated | An order is updated (status change, fulfillment, etc.) | Order Updated |
product.created | A new product is created | Product Created |
product.updated | A product is modified | Product Updated |
product.deleted | A product is deleted | Product Deleted |
customer.created | A new customer registers | Customer Created |
customer.updated | A customer is updated | Customer Updated |
customer.deleted | A customer is deleted | Customer Deleted |
category.created | A category is created | Category Events |
category.updated | A category is modified | Category Events |
category.deleted | A category is deleted | Category Events |
vendor.created | A vendor is created | Vendor Events |
vendor.updated | A vendor is modified | Vendor Events |
vendor.deleted | A vendor is deleted | Vendor Events |
discount.created | A discount is created | Discount Events |
discount.updated | A discount is modified | Discount Events |
discount.deleted | A discount is deleted | Discount Events |
subscriber.created | A new subscriber is added | Subscriber Events |
subscriber.updated | A subscriber is modified | Subscriber Events |
subscriber.deleted | A subscriber is removed | Subscriber Events |
Event names use dot notation (e.g. order.created), not PascalCase.
Payload versions
Each webhook has a new_version flag that controls the payload format:
-
new_version: 0(legacy) — The payload mirrors the internal API model format (Order::api()). Fields like prices use raw database values, addresses are flat, and the structure closely matches the internal data model. -
new_version: 1(recommended) — A clean, structured format with nested objects for customer, products, shipping, addresses, and payments. Prices are formatted as floats, dates are ISO 8601, and the structure is designed for external consumption.
The new_version flag currently only affects order events (order.created, order.updated). All other events use the same API model format regardless of this setting.
The event payload pages document the new version format. We recommend using new_version: 1 for all new integrations.
Retry mechanism
When a webhook delivery fails (network error, timeout, or 5xx response), CloudCart automatically retries with exponential backoff:
| Attempt | Delay | Total elapsed |
|---|---|---|
| 1st retry | 2 minutes | ~2 min |
| 2nd retry | 3 minutes | ~5 min |
| 3rd retry | 4 minutes | ~9 min |
| 4th retry | 5 minutes | ~14 min |
| 5th retry | 6 minutes | ~20 min |
After 5 failed retries, the webhook is automatically disabled and an alert is created in your store's admin panel.
Auto-disable on client errors
Certain HTTP response codes cause the webhook to be immediately disabled without retrying:
400, 401, 403, 404, 405, 406, 410, 411
These indicate a permanent problem with the endpoint (wrong URL, authentication failure, etc.) — retrying won't help.
Auto-delete
If the response body contains the text "please unsubscribe me", the webhook is permanently deleted.
Timeouts
Each webhook request has a 5-second timeout for connection, read, and total request time. Make sure your endpoint responds quickly — do heavy processing asynchronously.
Create a webhook
curl -X POST "https://mystore.cloudcart.com/api/v2/webhooks" \
-H "X-CloudCart-ApiKey: $CLOUDCART_API_KEY" \
-H "Content-Type: application/vnd.api+json" \
-d '{
"data": {
"type": "webhooks",
"attributes": {
"url": "https://example.com/webhooks/cloudcart",
"event": "order.created",
"new_version": 1
}
}
}'{
"data": {
"id": "42",
"type": "webhooks",
"attributes": {
"url": "https://example.com/webhooks/cloudcart",
"event": "order.created",
"active": 1,
"new_version": 1,
"request_headers": {}
}
}
}List webhooks
curl "https://mystore.cloudcart.com/api/v2/webhooks" \
-H "X-CloudCart-ApiKey: $CLOUDCART_API_KEY"Update a webhook
curl -X PATCH "https://mystore.cloudcart.com/api/v2/webhooks/42" \
-H "X-CloudCart-ApiKey: $CLOUDCART_API_KEY" \
-H "Content-Type: application/vnd.api+json" \
-d '{
"data": {
"id": "42",
"type": "webhooks",
"attributes": {
"url": "https://example.com/webhooks/v2/cloudcart",
"active": 1
}
}
}'Delete a webhook
curl -X DELETE "https://mystore.cloudcart.com/api/v2/webhooks/42" \
-H "X-CloudCart-ApiKey: $CLOUDCART_API_KEY"Returns 204 No Content.
Verifying webhook requests
Never process a webhook you haven't authenticated. Two mechanisms are available — verify at least one:
- HMAC signature — the
X-CloudCart-Signatureheader, an HMAC-SHA256 of the raw body. Strongest option; verification code in Security & Reliability. - API-key header — associate an API key with the webhook in the admin panel and CloudCart sends it as
X-CloudCart-ApiKeyon every delivery.
Best practices
Full checklist with code (signature verification, idempotency, retry handling) lives in Security & Reliability. The short version:
- Respond quickly. Return
200 OKimmediately and process the payload asynchronously. - Handle duplicates. The same event may be delivered more than once. Use the
idfield to deduplicate. - Use HTTPS. Always use an HTTPS endpoint to protect the payload in transit.
- Monitor failures. Check your admin panel alerts for disabled webhooks.