Dev

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

MethodPathDescription
GET/api/v2/webhooksList webhooks
GET/api/v2/webhooks/{id}Get a webhook
POST/api/v2/webhooksCreate a webhook
PATCH/api/v2/webhooks/{id}Update a webhook
DELETE/api/v2/webhooks/{id}Delete a webhook

Properties

FieldTypeDescription
urlstringThe endpoint URL that receives the POST request. Must be a valid URL. Required.
eventstringThe event to subscribe to (see Available events). Required.
activeintegerWhether the webhook is active (1) or disabled (0).
new_versionintegerPayload format version. 0 = legacy format, 1 = new structured format. See Payload versions.
request_headersobjectCustom HTTP headers sent with each webhook request (read-only, managed via the admin panel).

Available events

EventDescriptionPayload docs
order.createdA new order is placedOrder Created
order.updatedAn order is updated (status change, fulfillment, etc.)Order Updated
product.createdA new product is createdProduct Created
product.updatedA product is modifiedProduct Updated
product.deletedA product is deletedProduct Deleted
customer.createdA new customer registersCustomer Created
customer.updatedA customer is updatedCustomer Updated
customer.deletedA customer is deletedCustomer Deleted
category.createdA category is createdCategory Events
category.updatedA category is modifiedCategory Events
category.deletedA category is deletedCategory Events
vendor.createdA vendor is createdVendor Events
vendor.updatedA vendor is modifiedVendor Events
vendor.deletedA vendor is deletedVendor Events
discount.createdA discount is createdDiscount Events
discount.updatedA discount is modifiedDiscount Events
discount.deletedA discount is deletedDiscount Events
subscriber.createdA new subscriber is addedSubscriber Events
subscriber.updatedA subscriber is modifiedSubscriber Events
subscriber.deletedA subscriber is removedSubscriber 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:

AttemptDelayTotal elapsed
1st retry2 minutes~2 min
2nd retry3 minutes~5 min
3rd retry4 minutes~9 min
4th retry5 minutes~14 min
5th retry6 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-Signature header, 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-ApiKey on every delivery.

Best practices

Full checklist with code (signature verification, idempotency, retry handling) lives in Security & Reliability. The short version:

  • Respond quickly. Return 200 OK immediately and process the payload asynchronously.
  • Handle duplicates. The same event may be delivered more than once. Use the id field 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.

On this page